Hey guys, I'm having a little trouble appending ID's to the end of a line in my CSV file. At the moment the ID seems to be being placed after the newline character. Is there any way of using seekp() to go behind the newline character and append an ID?
My current code for adding the ID:
For example if a flight was to add an ID of 5 for a passenger, when it didn't have any previous ID's, it would turn out like so:
Layout Order - ID, Departure Date, Going From, Going To, Cost, ID
I would like it to look like so:
Thanks guys
My current code for adding the ID:
if(passengerSaveFile) { string s = ""; while( getline(passengerSaveFileInput, s) ) { istringstream ss( s ); i = 0; if(passedFlightID == atoi(&s[0])) { passengerSaveFile.seekp((strlen(s.c_str())-1)); passengerSaveFile << "-" << s << "\n"; } } }
For example if a flight was to add an ID of 5 for a passenger, when it didn't have any previous ID's, it would turn out like so:
Layout Order - ID, Departure Date, Going From, Going To, Cost, ID
1,24-06-2013,Edinburgh-Scotland,Paris-France,699.56, 5-
I would like it to look like so:
1,24-06-2013,Edinburgh-Scotland,Paris-France,699.56,5-
Thanks guys
