hi there. i'm writing a small function that reads a file (how original ) i tried this but it's only returning the first line. and then quiting
fullName() returns a string with the file name and everything goes fine. it read the first line then breaks off.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(); }
any ideas?