Path: csiph.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Bo Persson 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: References: 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: Xref: csiph.com comp.lang.c++:89482 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).