This is perfectly reasonable.
What you're interpreting as a blank line is just the way your text editor represents the presence of a \n
character at the end of your actual final line (generated by your final std::endl
). It makes sense for that character to be there, as it is as the end of all of your lines. Indeed, this is what "line ending" means!
If this is causing problems when you load the file back in, then I'd suggest that your real bug is in fact there.