Your file's first line is 20 characters long (19+new line) but pop[20]
can only contain 19 (because the last one is reserved for the null terminator '\0').
When istream::getline
stops because it has extracted 20-1 characters, it doesn't discard the new line delimiter (because it was never read). So the next getline
just reads the end of the first line, discarding the new line.
That's why you get nothing in the second string.