Whenever I am getting a line from a file by using the string getline() function, I seem to be getting an extra character. I am curious to know what exactly that character is. It recently caused me a bit of trouble trying to debug.
Let's say the file is like this:
and I use this code
getline(inf, line); cout << line.length();
I seem to be getting the number of characters in the line + 1, so with this example the length is 5. My file has no spaces after the text.