Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c++ > #89488
| 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-06 10:00 -0800 |
| Organization | None to speak of |
| Message-ID | <87ttyxlpyi.fsf@nosuchdomain.example.com> (permalink) |
| References | <tu532n$33e16$1@portraits.wsisiz.edu.pl> <k6mhs0FavanU1@mid.individual.net> <tu59ek$33qdu$1@portraits.wsisiz.edu.pl> |
Jivanmukta <jivanmukta@poczta.onet.pl> writes:
> W dniu 06.03.2023 o 17:14, Bo Persson pisze:
>> On 2023-03-06 at 17:06, Jivanmukta wrote:
>>> Please explain me why this code outputs text with \r\r\n, not
>>> \r\n. I run it in Windows 10. When I call my program with
>>> >__test.txt I see \r\r\n in file __text.txt.
>>> I don't know why additional \r in text outputed from get_help() - I
>>> have single END_LINE after each line (in returned string).
>>>
>>> #define END_LINE "\r\n"
>>>
>> On Windows (and unlike Linux) the code "\n" is expanded into two
>> characters (Carriage Return and NewLine). This is the way it has
>> been since always (since mechanical printers and such were used).
>>
> I changed definition of END_LINE:
>
> #define END_LINE "\n"
>
> and it solved the problem.
> Thank you for help.
I suggest it would be clearer to drop the END_LINE macro and use "\n"
or '\n' directly.
--
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