C Language - \n - creating virus
Posted
by sagar
on Stack Overflow
See other posts from Stack Overflow
or by sagar
Published on 2010-03-14T18:13:16Z
Indexed on
2010/03/14
18:25 UTC
Read the original article
Hit count: 233
#include<stdio.h>
#include<conio.h>
union abc
{
int a;
int x;
float g;
};
struct pqr
{
int a;
int x;
float g;
} ;
void main()
{
union abc b;
struct pqr c;
clrscr();
b.a=10;
textbackground(2);
textcolor(6);
cprintf(" A = %d",b.a);
printf("\nUnion = %d",sizeof(b));
printf("\nStructure = %d",sizeof(c));
getch();
}
Now, Save this program as virus.cpp ( or any name that you like ) I am using Turbo C comiler to complie this program & run from trubo c. ( Ctrl + F9 )
I don't know weather to ask this question at stack over flow or at super user.
I am using Windows 7 & I have installed Avira AntiVir virus system. I am not here for any kind of advertisement of microsoft or antivirus system.
I am just here for solution of my query.
When I tried to run above program - It creates a worm (DOS/Candy).
I believe there is nothing wrong in program.
Oke..
Now here is something special. Execute the same program with following difference. Here the only difference is space between \n
#include<stdio.h>
#include<conio.h>
union abc
{
int a;
int x;
float g;
};
struct pqr
{
int a;
int x;
float g;
} ;
void main()
{
union abc b;
struct pqr c;
clrscr();
b.a=10;
textbackground(2);
textcolor(6);
cprintf(" A = %d",b.a);
printf("\n Union = %d",sizeof(b));
printf("\n Structure = %d",sizeof(c));
getch();
}
The difference is only \n and space.
Question is "Why my simple program is detected as virus?? "
Thanks in advance for sharing your knowledge.
Sagar.
© Stack Overflow or respective owner