If you're writing a Windows application, try the DeleteFile function available in winbase.h:
BOOL DeleteFile(
LPCTSTR lpFileName // pointer to name of file to delete
);
cscgal
The Queen of DaniWeb
19,421 posts since Feb 2002
Reputation Points: 1,474
Solved Threads: 229
cscgal
The Queen of DaniWeb
19,421 posts since Feb 2002
Reputation Points: 1,474
Solved Threads: 229
Oh, goodness gracious! I guess it would be most appropriate to make this my 667th post then.
cscgal
The Queen of DaniWeb
19,421 posts since Feb 2002
Reputation Points: 1,474
Solved Threads: 229
Are those suppose to be horns? They look like donkey ears.
samaru
a.k.a inscissor
1,256 posts since Feb 2002
Reputation Points: 262
Solved Threads: 18
An easy way to delete a file is to just call a system command from Windows. dafile.txt is the file you want to delete.
#include <stdlib.h> // needed to use system() function
int main() {
system("del dafile.txt");
return 0;
}
samaru
a.k.a inscissor
1,256 posts since Feb 2002
Reputation Points: 262
Solved Threads: 18
What do you mean at closing? When you close your program? If so, just make it one of your last lines.
samaru
a.k.a inscissor
1,256 posts since Feb 2002
Reputation Points: 262
Solved Threads: 18
Ebil cscgal :twisted:
Anyway, how would I do that so it deleted the file at closing?
you can register a function that will be called when the program terminates with the atexit() function. this func could tehn call remove() on the file.
infamous
Junior Poster in Training
77 posts since Mar 2004
Reputation Points: 47
Solved Threads: 2