31 Jul 2012

C Program which delete itself

Here I'm sharing a program which will destroy itself. When you will compile this code it will generate an exe file but it will delete itself upon execution. This is a self destructing C Program. Here is the source code.
void main()
printf(“This program will destroy itself if u press any key!!!\n”);
remove(_argv[0]);/*array of pointers to command line arguments*/

For better observation I'll suggest to execute this code from command line. If you're having troubles in Compiling the code then take a look How to Compile a C Program.


Post a Comment

Design by Free WordPress Themes | Bloggerized by Lasantha - Premium Blogger Themes | Online Project management