Skip to content

Instantly share code, notes, and snippets.

@wateroot
Created June 13, 2014 03:43
Show Gist options
  • Select an option

  • Save wateroot/0cf81805d9d0ef6f6974 to your computer and use it in GitHub Desktop.

Select an option

Save wateroot/0cf81805d9d0ef6f6974 to your computer and use it in GitHub Desktop.
ZapDelFile
BOOL ZapDelFile(char *szFileToDel)
{
char cTempFileName[MAX_PATH] = {0};
char cTempPathName[MAX_PATH] = {0};
char cFileName[MAX_PATH+1] = {0};
GetSystemDirectory(cTempPathName, MAX_PATH);
strcat(cTempPathName, "\\");
if(GetTempFileName(cTempPathName, "x", 0, cTempFileName) == 0)
{
return FALSE;
}
if(MoveFileEx(szFileToDel, cTempFileName, 1) == 0)
{
return FALSE;
}
if(MoveFileEx(cTempFileName, NULL, 4) == 0)
{
return FALSE;
}
return TRUE;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment