I'm writing a program on a Linux platform that is generating text files that will be viewed on, inevitably, a Windows platform.
Right now, passing std::endl into a ostream generates the CR character only for newlines.  Naturally, these text files look wrong in MS Notepad.
std::endl such that it uses CR+LF for newline instead of LF?win_endl, for generating my own newlines, but I use the std::endl symbol in a lot of places, and like many programmers, have a tendency to do the thing that requires the least work possible.  Could I simply overload std::endl to produce CR+LF, or is this a dumb idea for maintainability?NB: I checked out this question, but it's asking about going the other way, and the accepted answer seems rather incomplete.
Windows Notepad is pretty much the only Windows program you'll find that doesn't handle LF-only files properly. Almost everything else (including WordPad) handles LF-only files just fine.
This problem is a bug in Notepad.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With