Saturday

A Self Destructing Program in C

This program will destroy itself upon execution.The program will cause the .exe file to be deleted upon execution.That is this program is capable of destroying itself upon execution.Heres the code

#include<stdio.h>
#include<conio.h>
#include<dos.h>
void main()
{
printf("This program will destroy itself if u press any key!!!\n");
getch();
remove(_argv[0]);/*array of pointers to command line arguments*/
}

HOW TO COMPILE ?
Load the source code to the compiler and compile(press Alt-F9) and then press F9.This will generate the .exe file in the current directory(Bin directory).Execute this .exe file it will destroy itself upon execution.

Readers Who Read This Page, Also Read:

How To Create A Virus In C

A C Program Without A Main Function

A C Program To Print It's Own Source Code

A Simple Password Program

4 comments:

Unknown said...

i donot understand remove(_argv[0])

Srikanth said...

Whenever we run any program the element _argv[0](array of ptrs to command line arguments) contains the name of the program itself.For eg: If we are running a program(.exe file) whose name is "sample.exe" then the _argv[0] would contain this name.That is why we are passing _argv[0](nothing but the name of the program) as an argument to remove() function which will delete itsef eventually

Anonymous said...

hi
,i am bharadwaj and i want to destroy orkut account with a simple program is there any posibility pls
check it

Srikanth said...

@ Bharadwaj

Are you joking? It's not possible yaar...