Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c++ > #89488
| Path | csiph.com!weretis.net!feeder8.news.weretis.net!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail |
|---|---|
| From | Keith Thompson <Keith.S.Thompson+u@gmail.com> |
| Newsgroups | comp.lang.c++ |
| Subject | Re: why additional \r before each \r\n |
| Date | Mon, 06 Mar 2023 10:00:53 -0800 |
| Organization | None to speak of |
| Lines | 29 |
| 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> |
| MIME-Version | 1.0 |
| Content-Type | text/plain; charset=utf-8 |
| Content-Transfer-Encoding | 8bit |
| Injection-Info | reader01.eternal-september.org; posting-host="5c1233dfadea1cd64002867ff687e744"; logging-data="19656"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18lUzZHKJHJMGOJzXEEr1Ib" |
| User-Agent | Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) |
| Cancel-Lock | sha1:fn+ifp97p2hJ4pgGaBMB6XR7qi8= sha1:KM8mpWZ8CmMmC12CgVy9UTjM8ls= |
| Xref | csiph.com comp.lang.c++:89488 |
Show key headers only | View raw
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