C-language implementation for modifying file suffixes

Source: Internet
Author: User

in the actual software development project, you may encounter the need to modify the suffix of the file ( For example, to modify the Doc format to docx format ) . This article provides a C Language implementation that modifies the file suffix and demonstrates the process of modifying the file suffix.

1. C Program Implementation


2. procedure for modifying suffixes

Step 1 :

in the local D disk, there is a call " Test " folder, under which there is a folder named " 123.doc " file, as shown in:

        Create a new two folder under either folder, named old2new " ( ) and " ( Indicates that the new suffix is modified to the old suffix and c " changesuffix.exe " Copy to two folders.

Step 2 :

under these two folders, create a new file named " Config.ini " configuration file with each configuration entry in the file as follows:

[General]

; Converts the old suffix to a new suffix, or converts the new suffix to the old suffix, 1--old, new, 2--new

Old2newornew2old =

; Old file suffix (support configuration multiple, middle has; separate)

Oldsuffix = Doc;xls;ppt

; New file suffix (support configuration multiple, middle has; separate)

Newsuffix = Docx;xlsx;pptx

" old2new " old2newornew2old " set to 1 , " new2old " in the folder " old2newornew2old " set to 2

Step 3 :

in the " old2new " folder under new name " Update.bat " batch file with the contents of the file:

changesuffix "d:\\test" 0

among them, " d:\\test " is the path to the file where the suffix is to be modified.

in the " New2old " folder under new name " Update_restore.bat " batch file with the contents of the file:

Changesuffix "d:\\test" 1

among them, " d:\\test " is the path to the file where the suffix is to be modified.

" old2new " and the " New2old " the following files are stored under two folders:

Step 4 :

individually double-click " Update.bat " and the " Update_restore.bat " , the conversion function of old new and old suffix can be realized.

(I Weibo:http://weibo.com/zhouzxi?topnav=1&wvr=5, No.: 245924426, welcome attention!) )

C-language implementation for modifying file suffixes

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.