the first part of theprogram is working on adding host but an error is generating again and again that search is not a function of 'ofstream'.
plz help me out
#include <fstream.h>
#include <iostream.h>
#include <string.h>
int main()
{
char site[20],c,d;
ifstream in; ofstream out;
cout<<"press 1 to block website & press 2 to open website";
cin>>d;
switch(d)
{
case 1:
{
cout<<"Enter the Name of the Site to Block \n";
cin>>site;
out.open("C:/Windows/System32/drivers/etc/hosts",ios::app);
if(!out)
cout<<"Either File Not Found or Permission Denied, Run as Admin the EXE of the Program";
else
out<<"127.0.0.1"<<"\t"<<site;
out.close();
return 0;
}
case 2:
{
cout<<"Enter the Name of Website to open \n";
cin>>site;
out.open("C:/Windows/System32/drivers/etc/hosts",ios::app);
if(!out)
cout<<"Either File Not Found or Permission Denied, Run as Admin the EXE of the Program";
else
out.replace(out.find(site),site.length()," ");
out.close();
return 0;
}
case default:
cout<<"wrong choice dude run exe again";
}return 0;
}