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

From Bo Persson <bo@bo-persson.se>
Newsgroups comp.lang.c++
Subject Re: why additional \r before each \r\n
Date 2023-03-06 17:14 +0100
Message-ID <k6mhs0FavanU1@mid.individual.net> (permalink)
References <tu532n$33e16$1@portraits.wsisiz.edu.pl>

Show all headers | 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