Another Deleting File Program Example
Create a new empty Win32 console application project. Give a suitable project name and change the project location if needed.
Then, add the source file and give it a suitable name.
Next, add the following source code.
int main(int argc, char *argv)
BOOL fSuccess = FALSE;
fSuccess = DeleteFile(TEXT("C:\\testing.txt"));
// Handle the error.
printf ("DeleteFile() failed, error %d\n", GetLastError());
printf ("DeleteFile() is OK!\n");
Build and run the project. The following screenshot is a sample output.
The Unicode version can be found in the download page.