Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c++ > #89482

Re: why additional \r before each \r\n

Path csiph.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From Bo Persson <bo@bo-persson.se>
Newsgroups comp.lang.c++
Subject Re: why additional \r before each \r\n
Date Mon, 6 Mar 2023 17:14:56 +0100
Lines 18
Message-ID <k6mhs0FavanU1@mid.individual.net> (permalink)
References <tu532n$33e16$1@portraits.wsisiz.edu.pl>
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding 7bit
X-Trace individual.net fEgjkiAk1Yk69ZXgQ6UZxwG+hHSKBNbww1+PwYRI/24lBPgYPM
Cancel-Lock sha1:VNcOehPKlUgCPY3IQKsYOnTUj+A=
User-Agent Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.8.0
Content-Language sv
In-Reply-To <tu532n$33e16$1@portraits.wsisiz.edu.pl>
Xref csiph.com comp.lang.c++:89482

Show key headers only | View raw


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).




Back to comp.lang.c++ | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


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