VC实现文件的拷贝移动

来源:互联网 发布:淘宝卖家怎么收款 编辑:程序博客网 时间:2024/05/29 07:38
BOOL CopyFile(  LPCTSTR lpExistingFileName,  LPCTSTR lpNewFileName,  BOOL bFailIfExists);
lpExistingFileName
[in] Pointer to a null-terminated string that specifies the name of an existing file.

In the ANSI version of this function, the name is limited to MAX_PATH characters. To extend this limit to 32,767 wide characters, call the Unicode version of the function and prepend "//?/" to the path. For more information, see Naming a File.

Windows Me/98/95:  This string must not exceed MAX_PATH characters.
lpNewFileName
[in] Pointer to a null-terminated string that specifies the name of the new file.

In the ANSI version of this function, the name is limited to MAX_PATH characters. To extend this limit to 32,767 wide characters, call the Unicode version of the function and prepend "//?/" to the path. For more information, see Naming a File.

Windows Me/98/95:  This string must not exceed MAX_PATH characters.
bFailIfExists
[in] If this parameter is TRUE and the new file specified by lpNewFileName already exists, the function fails. If this parameter is FALSE and the new file already exists, the function overwrites the existing file and succeeds.

 

 

 

该函数可以显示文件以及文件夹的整体拷贝和移动,例子如下:

 

CopyFile(_T("E://01.bmp"),_T("F://01.bmp"),FALSE );

 

把E盘的拷贝并移动到F盘

原创粉丝点击