
31 May
2012
31 May
'12
4:17 a.m.
On Thu, 31 May 2012, James Harper <james.harper@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.
Is each file self-consistent in what it uses though? Or could it switch between CR, LF, and CR+LF as EOLs? If so, is CR+LF+LF+CR+LF 3, 4, or 5 EOLs? James