Aug 9, 2011 at 6:31am UTC
hello
void compress::makeDict( ifstream &fin)
{
string word;
while(fin){
fin>>word;
cout<<word<<endl;
}
}
In the above function if fin is taken as constant reference (const ifstream &fin), it is throwing an error even though i am not changing fin inside the function. just reading the file.
error: no match for 'operator>>' in 'fin >> word
Aug 9, 2011 at 7:48am UTC
What Syuf means is that in order to read the file, you need to modify the std::fstream object. No way around it.
Aug 9, 2011 at 8:36am UTC
hello syuf and helios, thanks of your reply.
can you please explain a bit more "in order to read the file, you need to modify the std::fstream object" ??? how it gets modified ??
Aug 9, 2011 at 9:18am UTC
While reading you change the get pointer position.