请问如何在cb的程序中实现文件的移动?
如题,我想在程序中实现对某个文件的移动,比如从某个目录下移动到另外一个目录,怎么实现? 问题点数:20、回复次数:5Top
1 楼RomanticProgrammer() 兰企鹅||南极俺最帅 ()回复于 2003-12-02 23:38:38 得分 2
BOOL MoveFile(
LPCTSTR lpExistingFileName, // pointer to the name of the existing file
LPCTSTR lpNewFileName // pointer to the new name for the file
);
Parameters
lpExistingFileName
Pointer to a null-terminated string that names an existing file or directory.
lpNewFileName
Pointer to a null-terminated string that specifies the new name of a file or directory. The new name must not already exist. A new file may be on a different file system or drive. A new directory must be on the same drive.
Top
2 楼RomanticProgrammer() 兰企鹅||南极俺最帅 ()回复于 2003-12-02 23:41:03 得分 2
WINSHELLAPI int WINAPI SHFileOperation(
LPSHFILEOPSTRUCT lpFileOp
);
typedef struct _SHFILEOPSTRUCT{
HWND hwnd;
UINT wFunc;
LPCSTR pFrom;
LPCSTR pTo;
FILEOP_FLAGS fFlags;
BOOL fAnyOperationsAborted;
LPVOID hNameMappings;
LPCSTR lpszProgressTitle;
} SHFILEOPSTRUCT, FAR *LPSHFILEOPSTRUCT;
//////////////////
wFunc = FO_MOVE ;
pFrom =????;
pTo = ???;Top
3 楼pp616(坏蛋)回复于 2003-12-03 01:54:10 得分 0
CopyFileEx 然后 DeleteFile可以显示进度Top
4 楼gaotx0606(双子boy)回复于 2003-12-03 20:09:10 得分 0
呵呵,我比较笨,可否给个程序例子Top
5 楼zhaowd()回复于 2003-12-04 11:06:30 得分 16
MoveFile(String("c:\\data.txt").c_str(),String("d:\\data.txt").c_str())Top




