+ 3

How to write a program in C++ such that it will delete itself after execution ?

3rd Jun 2017, 2:27 PM
Jerry Huang
Jerry Huang - avatar
4 ответов
+ 1
It doesn't work for Windows.
3rd Jun 2017, 2:41 PM
Jerry Huang
Jerry Huang - avatar
+ 1
batch file?
4th Jun 2017, 7:39 AM
Jerry Huang
Jerry Huang - avatar
0
You cannot really delete a file from itself, it's just nonsense. However the only way I think it would be possible is to call a Bash file (or similar OS language file) and delay it so that your program finishes and the Bash deletes your .exe.
3rd Jun 2017, 6:16 PM
Norbivar
Norbivar - avatar