making antivirus

I made a virus in the f folder of my windows 10 but my antivirus does not display virus.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#include<iostream>
#include<fstream>
using namespace std;
int main()
{
        ifstream f1;
        f1.open("F:\");
        string line;
        while(f1>>line)
        {
                if(line=="virus.exe")
                cout<<line;
        }
f1.close();
} 
Last edited on
@suyashsing234,
F:\ is the root of the F: drive of your computer - whatever that is; probably a USB drive. It is not a text file. Your program would only have any chance of doing anything if (a) it tried to open a standard text file and (b) that file contained the words tested in line.

OK, that is the coding issue.

There is, however, a bigger problem here, and that is what your recent posts suggest you are aspiring to do. (Fortunately for the rest of the world you are a long way from it and stand a fair chance of wiping out your own computer system before damaging anybody else's.) Coding computer viruses is not clever ... and not an intelligent use of programming or computational ability and resources. If you want to do something really meaningful in life then I suggest you redirect your studies to programs that might benefit humankind, such as those in molecular biology to combat real biological viruses and provide targeted drugs.


but i want to become ethical hacker.That is i want to make antivirus and make computer systems protected against viruses.
There is no such creature as an "ethical hacker," doing things without a user's knowledge or actions.

Someone knowingly installs an anti-virus app on their device. You keep mentioning you want to do it without permission or letting a user know you are hacking.
Registered users can post here. Sign in or register to post.