On Thu, 31 May 2012, James Harper
<james.harper(a)bendigoit.com.au> wrote:
Is there
a library routine like fgets() but which takes any of CR, NL,
and CR+NL as an end of line?
I'm pretty sure there isn't. Is using sscanf out of the question? You may
be able to construct a format string that does what you want unless you
really do want a CR by itself to also represent a linefeed (which I can't
think how to do using sscanf).
I really need to support either.
I'm dealing with the output of a Windows program that seems to convert between
DOS and Unix file formats.
Put something like tr or sed s/\r$// in front of your real program,
and let it deal with unfucking CRLF files.