Deletefile函数怎么使用
RT,想删除某EXE所在的文件夹里的某某文件,应该如何写?
[解决办法]
String strFileName= ExtractFilePath(ParamStr(0)) + "123.txt";
Deletefile(strFileName);
void __fastcall TForm1::Button1Click(TObject *Sender)
{
SetCurrentDir(Application->ExeName);
HANDLE handle = CreateFile("123.txt",GENERIC_READ
[解决办法]
GENERIC_WRITE,FILE_SHARE_READ,NULL,OPEN_ALWAYS,FILE_ATTRIBUTE_NORMAL,0);
if(handle==INVALID_HANDLE_VALUE)
{
MessageBox(NULL,"Error Create File!","Error",MB_OK);
}
else
{
MessageBox(NULL,"Open file Success!","Open file",MB_OK);
CloseHandle(handle);
}
}