The problem is the output always has one more character as same as the last character in text file.
For example: "i have a mouse" this string in text.txt
when i run the program it always print out i have a mousee
Does somebody know what's happening with it? Thanks!
while (!fin.eof()) {
fin.get(character);
myList.push_back(character);
}
eof will be set when you read it. The operation fails and character does not change (I think that's undefined), but you put it in the list again.
Change it to