File Operations in the File Manager

Source: Internet
Author: User

File Operations in the File Manager

Next we will introduce some file-related operations, which are some APIs provided by Microsoft Windows.
• File Replication
Bool copyfile (maid, maid );
Copy the file or directory lpexistingfilename to the file or directory lpnewfilename. If bfailifexists is true, if a file with the same name as lpnewfilename exists, the copy operation is not performed and an error is returned. If bfailifexists is false, the file with the same name as lpnewfilename is overwritten.
• File Movement
Bool movefile (maid, maid );
Move the lpexistingfilename file or directory to the file or directory lpnewfilename.
• File opening
Open a specified file or run the specified application.
Hinstance ShellExecute (hwnd, lpctstr lpoperation, lpctstr lpfile,
Lptstr lpparameters, lptstr lpdirectory, int nshowcmd );
• File Search
The following three API functions are required to search for a file:
• Handle findfirstfile (lptstr lpfilename, lpwin32_find_data lpfind filedata );
Find the first file that complies with the lpfilename rule.
• Bool findnextfile (handle hfindfile, lpwin32_find_data lpfindfiledata );
Find the next file that complies with the lpfilename rule.
• Bool findclose (handle hfindfile );
After the search is completed, release the resources used for the search. This is not necessary, but if the reader wants to be a qualified programmer, this must be done, A necessary code for programmers is to keep in mind the recycling of resources, which will lead to adverse consequences due to the absence of recycling resources. I will not go into details here. These negative cases can be seen everywhere.

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.