System/Windows
파일복사 api
TaeSun1114
2012. 8. 2. 17:00
BOOL CopyFile( LPCTSTR lpExistingFileName LPCTSTR lpNewFileName, BOOL bFailIfExists );
lpExistingFileName : 원본파일의 경로
lpNewFileName : 복사될파일의 위치
bFailfExitsts : 파일이 이미 존재하면 덮어쓸지 유무, FALSE옵션을주면 덮어씀, TRUE를 주면 덮어쓰지 않음.
ex)
#include<stdio.h>
#include<Windows.h>
int main()
{
char path[]="C:\\Documents and Settings\\Administrator\\My Documents\\Visual Studio 2010\\Projects\\bad_code\\Debug\\FileName.exe";
char new_path[]="C:\\bad_code.exe";
CopyFile(path,new_path,false);
return 0;
}