only first line being extracted from file
hi there. i'm writing a small function that reads a file (how original :p) i tried this but it's only returning the first line. and then quiting
Code:
string C_fsystem::readLine(void)
{
ifstream TMP_file;
string TMP_buffer;
TMP_file.open(fullName().c_str());
if (TMP_file.fail()){cout<<"error opening file. quitting";cin.get();exit(1);}
while (!TMP_file.eof())
{
getline(TMP_file,TMP_buffer);
cout<<TMP_buffer;
}
TMP_file.close();
}
fullName() returns a string with the file name and everything goes fine. it read the first line then breaks off.
any ideas?