标签:
//////////////////////////////////////////////////////////////////////////HANDLE hfile = INVALID_HANDLE_VALUE;
BOOL bok = FALSE;
char ZeroBuf[512];
int index = 0;
ZeroMemory(ZeroBuf, sizeof(ZeroBuf));
do
{
SetFileAttributes(strFilePath, FILE_ATTRIBUTE_NORMAL);hfile = CreateFile(strFilePath,
GENERIC_READ | GENERIC_WRITE,0,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL);
if (hfile == INVALID_HANDLE_VALUE){
break;
}
DWORD nsize = GetFileSize(hfile, NULL);
int nWriteCount = nsize / sizeof(ZeroBuf);nWriteCount = max(nWriteCount, 1);DWORD dwBytes = 0;
for (int i = 0; i < nWriteCount; i++){
WriteFile(hfile, ZeroBuf, sizeof(ZeroBuf), &dwBytes, NULL);
}
index++;CloseHandle(hfile);
}
} while (index < 1);
bok = DeleteFile(strFilePath);
return bok;
标签:
原文地址:http://blog.csdn.net/goodboy_wkx/article/details/43733681