Help. Anyone tell me why this code outputs 7 lines (the last line twice) while the file contains 6 lines?
cout << "read msgfile\n";
ifstream msgfile ("script1.msg");
while (msgfile.good()) //if not at end of file, continue reading
{
// load vector with deffile
msgfile >> line;
vectormsgfile.push_back (line);
cout << line << "\n";
}
msgfile.close();
Cheers and tx


Reply With Quote


Bookmarks