Reputation: 4453
I need to delete a temporary file from my C++ windows application (developed in Borland C++ Builder). Currently I use a simple:
system("del tempfile.tmp");
This causes a console window to flash in front of my app and it doesn't look very professional. How do I do this without the console window?
Upvotes: 5
Views: 6062
Reputation: 22922
Or, even the standard C library function int remove( const char *path );
.
Upvotes: 16
Reputation: 1912
For a slightly more portable (I.e. that works in both Windows and UNIX), I use unlink() or the ISO conformant _unlink() in io.h (unlink() for UNIX include unistd.h)
Remove() actually calls _unlink().
Upvotes: 2
Reputation: 69400
It sounds like you need the Win32 function DeleteFile(). You will need to #include <windows.h>
to use it.
Upvotes: 15