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?
Or, even the standard C library function int remove( const char *path );
.
It sounds like you need the Win32 function DeleteFile (). You will need to #include <windows.h>
to use it.
For a slightly more portable (Ie 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().
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.