fstream dict ("c://example.txt",ios::in);
if (!dict.is_open())
{
cout << "Unable to open file";
exit(1);
}
cout<<"Enter word to search \n";
cin>>word;
while(getline(dict,line))
cout<<line<<"\n";
return 0;
}
Now when i compile, turbo c++ tells me that is_open is not a member of 'fstream'. Also, it tells me that getline prototype is missing. Now I really don't know what to do now.
I basically want to search a user provided string in a .txt file format and if the string exists, I want to continue my program and if it doesn't, I wish to take user input again.
Please don't give me lame answers. I have to be graded on it.
Thank you