I was stung by not knowing this here.
Jokes apart, I'd be very useful if that info bar was provided. All lines end with \n?
4 lines, showing 4 (POSIX-compliant file)
As before, but the last line has no line terminator?
4 lines, showing 4 (non-POSIX-compliant file)
All lines end with \r\n except the last?
4 lines, showing 4 (typical Windows file)
Some lines end with \n other with \r\n?
4 lines, showing 4 (file with Windows and Unix mixed line endings)
All other cases?
Something like this I guess can be easily handled by having some function return an enum telling which case it is.
I was stung by not knowing this here.
Jokes apart, I'd be very useful if that info bar was provided. All lines end with
\n?As before, but the last line has no line terminator?
All lines end with
\r\nexcept the last?Some lines end with
\nother with\r\n?All other cases?
Something like this I guess can be easily handled by having some function return an enum telling which case it is.