cpp: Handle files without EOL at EOF