What is going wrong here?? file appending problem
-
THIS WORKS file is appended with the text "###, 28/06/07, 09:30, 1.736, 1.234" Message Box correctly reports fileName as expected. fstream FileDataStream; // Read Data FileDataStream.open(fileName, ios::out | ios::app); // Append Data FileDataStream<<"###,"; FileDataStream<<(LPCSTR)dateString<<','<<(LPCSTR)timeString<<','; sprintf(buf, "%.4f,", eTable[5*sel + 2]); // GeskeDose FileDataStream<
-
THIS WORKS file is appended with the text "###, 28/06/07, 09:30, 1.736, 1.234" Message Box correctly reports fileName as expected. fstream FileDataStream; // Read Data FileDataStream.open(fileName, ios::out | ios::app); // Append Data FileDataStream<<"###,"; FileDataStream<<(LPCSTR)dateString<<','<<(LPCSTR)timeString<<','; sprintf(buf, "%.4f,", eTable[5*sel + 2]); // GeskeDose FileDataStream<
Looks like I needed to call FileDataStream.clear(); I think that some error flag is set when the while loop pulls in the EOF marker while reading the file, and that is what causes the problem when you next try to open it.