case 4:
{
cout<<"Enter the word you want to delete: ";
gets(b);
f1.open("anotherf.txt",ios::in);
f2.open("tempf.txt",ios::out);
while(!f1.eof())
{
f1>>a;
i++;
if(strcmp(a,b)==0)
{
j=i;
}
}
i=0;
while(!f1.eof())
{
if(i!=j)
{
f1>>a;
f2<<a;
}
i++;
}
f1.close();
f2.close();
f2.open("tempf.txt",ios::in);
f2.seekg(0);
f1.open("anotherf.txt",ios::out);
while(!f2.eof())
{
f2>>a;
f1<<a;
}
goto menu;
}
I am trying to delete a certain element from a file. However when i run it it only displays blank. And from testing it, i THINK it doesn't even reach the part of the code where the information is passed from the second file back to the first.Im new to file handling, please help! Tha