One thing I'm not pretty sure after googling for a while, is the returned string of getline(). Hope to get it confirmed here.
std::getline
This global version returns a std::string so it's not necessarily null-terminated. Some compilers may append a '\0' while the others won't.
std::istream::getline
This function returns a c-style string so it's guaranteed that the string is null-terminated.
Is that right?
std::string
. A string object stores the length and the pointer to the first byte of the string, and that is it. What you are guaranteed however is that when you call c_str, you get a null terminated array of characters. – Osmundstd::string
's data is null-terminated. – Hammerskjold