Created
June 13, 2014 03:43
-
-
Save wateroot/0cf81805d9d0ef6f6974 to your computer and use it in GitHub Desktop.
ZapDelFile
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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