Sunday, July 12, 2009

How do I delete a file with C++?

Should be simple. How do I delete a file with C++?


thanks.

How do I delete a file with C++?
#include %26lt;stdio.h%26gt;





int remove( const char *path );


int _wremove( const wchar_t *path );
Reply:well file c++ doesn't allow you to delete files for security reason, only read/write. BUT you can delete files in c++ by outputting a command to command prompt which simply uses the funtion system(). try this





...


system("del FILE HERE")


....





that will delete it, unless the file is read only but its easy to override with some simple cmd commands.


No comments:

Post a Comment