imagenetics
Programmer
How to write a program that deletes itself at system startup/shutdown?
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
// self-remover.c
// Destined to be:
// C:\self-remover.exe
#include <stdio.h>
int main( void )
{
int i;
/* remove the file */
remove( "C:\\self-remover.exe" );
/* Do some other stuff */
printf( "Hello, world.\n" );
for ( i = 0; i < 3000; ++i )
{
printf( "%d\n", i );
}
printf( "The file that generated me is gone, "
"but I, the process, still remain!\n" );
return 0;
}