Hey guys,
I'm working on another program, and have run in to another problem.
Basically for this program, I read and extract information from a file. I do not know when the file is going to end, so I used a while loop to get my data.
This is all I have done, haven't proceeded since the loop doesn't work.
Hey guys,
I'm working on another program, and have run in to another problem.
Basically for this program, I read and extract information from a file. I do not know when the file is going to end, so I used a while loop to get my data.
This is all I have done, haven't proceeded since the loop doesn't work.
void extract ( string file_name, ifstream& fin )
{
int i = 0;
string temp;
fin.open( file_name.c_str( ) );
fin >> temp;
cout << temp;
while ( !fin.eof( ) )//THIS PART DOES NOT WORK I've also tried while (fin) while (!fin.fail( )) can't seem to get it to work
{
//STUFF
}
What I want it to do is end the program, when there is no more info in the file.
Thanks.