Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c++ > #89513
| From | Keith Thompson <Keith.S.Thompson+u@gmail.com> |
|---|---|
| Newsgroups | comp.lang.c++ |
| Subject | Re: why additional \r before each \r\n |
| Date | 2023-03-07 12:17 -0800 |
| Organization | None to speak of |
| Message-ID | <87ttywqpsx.fsf@nosuchdomain.example.com> (permalink) |
| References | (1 earlier) <k6mhs0FavanU1@mid.individual.net> <tu59ek$33qdu$1@portraits.wsisiz.edu.pl> <87ttyxlpyi.fsf@nosuchdomain.example.com> <tu5f9q$343r9$1@portraits.wsisiz.edu.pl> <tu6ltn$a35r$1@dont-email.me> |
Paavo Helde <eesnimi@osa.pri.ee> writes:
> 06.03.2023 20:35 Jivanmukta kirjutas:
[...]
>> You are right. I used macro because I had 2 different definitions
>> for Linux and for Windows. Now I have identical definitions and
>> macro is not necessary.
>
> But you still have different file contents in Windows and in Linux,
> because of the "helpful" translation of line feeds in text mode. This
> just complicates things and is not needed for anything because
> nowadays the files are commonly shared over the network and can easily
> end up on a "wrong platform".
>
> Suggesting to always use binary mode file streams and '\n' newlines
> when writing files, to get predictable and fixed behavior. Nowadays
> even Notepad copes with the Unix-style newlines, so there should be no
> need to have any \r\n newlines around.
Another approach is to use the native encoding for each operating
system. Many (but not all) Unix/Linux tools handle files with
Windows-style line endings.
Yes, it can be annoying, but it's workable.
--
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
Working, but not speaking, for XCOM Labs
void Void(void) { Void(); } /* The recursive call of the void */
Back to comp.lang.c++ | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
why additional \r before each \r\n Jivanmukta <jivanmukta@poczta.onet.pl> - 2023-03-06 17:06 +0100
Re: why additional \r before each \r\n Bo Persson <bo@bo-persson.se> - 2023-03-06 17:14 +0100
Re: why additional \r before each \r\n Bo Persson <bo@bo-persson.se> - 2023-03-06 17:17 +0100
Re: why additional \r before each \r\n Jivanmukta <jivanmukta@poczta.onet.pl> - 2023-03-06 18:55 +0100
Re: why additional \r before each \r\n Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2023-03-06 10:00 -0800
Re: why additional \r before each \r\n Jivanmukta <jivanmukta@poczta.onet.pl> - 2023-03-06 19:35 +0100
Re: why additional \r before each \r\n Paavo Helde <eesnimi@osa.pri.ee> - 2023-03-07 08:34 +0200
Re: why additional \r before each \r\n Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2023-03-07 12:17 -0800
Re: why additional \r before each \r\n Jivanmukta <jivanmukta@poczta.onet.pl> - 2023-03-06 17:24 +0100
Re: why additional \r before each \r\n James Kuyper <jameskuyper@alumni.caltech.edu> - 2023-03-06 14:30 -0500
csiph-web