4 ms·
Isn't a string with a newline character automatically multiline? The new line is just empty but not the first line anymore.
by croes 3y ago
Isn't a string with a newline character automatically multiline?
The new line is just empty but not the first line anymore.
- Joker_vD 3y agoNo, it is not. 3.195 Incomplete Line A sequence of one or more non-<newline> characters at the end of the file. 3.206 Line A sequence of zero or more non-<newline> characters plus a terminating <newline> character. courtesy of [0]. See also [1] for rationale on "text file": Text File [...] The definition of "text file" has caused controversy. The only difference between text and binary files is that text files have lines of less than {LINE_MAX} bytes, with no NUL characters, each terminated by a <newline>. The definition allows a file with a single <newline>, or a totally empty file, to be called a text file. If a file ends with an incomplete line it is not strictly a text file by this definition. [...] [0] https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1... [1] https://pubs.opengroup.org/onlinepubs/9699919799/xrat/V4_xbd_chap03.html https://pubs.opengroup.org/onlinepubs/9699919799/xrat/V4_xbd...
- rerdavies 3y agoApplications that write "incomplete lines" - VSCODE - Visual Studio - Notepad C/C++ compilers that process "incomplete lines" All of them. Will my users consider it a bug if my program doesn't process "incomplete lines": Yes. (Yes, I have had this bug logged against code that I wrote). Will I consider it a bug if your program doesn't process "incomplete lines": Yes.
- Joker_vD 3y ago> Applications that write "incomplete lines" Note that all of those three apps come from the Windows world where CRLF was indeed a line separator, and a file ending with CRLF was considered to have an empty line at the end. But yes, you absolutely should accommodate for incomplete lines.
- croes 3y agoNot everything uses POSIX maybe that's a reason for the different results.