Article View: comp.sys.mac.programmer.codewarrior
Article #1049CW "Map newlines to CR" chaos
From: Christopher Corbell
Date: Thu, 07 Mar 2002 01:03
Date: Thu, 07 Mar 2002 01:03
29 lines
2104 bytes
2104 bytes
It seems that newlines-to-CR does odd things, and even if unchecked some odd things can happen. With newlines-to-CR off, writing a std::endl to an fstream writes '\r' but writing std::endl to a stringstream writes '\n'. However writing a std::string which contains carriage returns to an fstream translates '\r' to '\n'!!! With newlines-to-CR on, I noticed a really bizarre thing: writing a literal '\r' to an fstream produces a '\n' in the file. Which isn't map-newlines-to-CR, it's map-CR-to-newline! Is all of this documented somewhere? I searched the manuals for "newline" and nothing came up. What I'd really like is to have std::endl always be the same thing regardless of whether it's going to an fstream or a stringstream, and also have '\r' in code always mean '\r' in the byte and its subsequent i/o, and sim. for '\n' to always mean '\n', with no translation other than what the programmer does explicitly. If this is possible in MSL C++, what does it involve other than the newlines-to-CR setting? Thanks for info, Chris
Technical Details
Message-ID:
<3C86BC4F.9930D425@vernier.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!canoe.uoregon.edu!logbridge.uoregon.edu!HSNX.atgi.net!sjc-peer.news.verio.net!news.verio.net!sn-xit-01!sn-post-01!supernews.com!corp.supernews.com!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10bcce,1e3721ce480a395b,start
X-Google-Attributes: gid10bcce,public
X-Google-Thread: f635e,1e3721ce480a395b,start
X-Google-Attributes: gidf635e,public
X-Google-ArrivalTime: 2002-03-06 17:03:08 PST
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!canoe.uoregon.edu!logbridge.uoregon.edu!HSNX.atgi.net!sjc-peer.news.verio.net!news.verio.net!sn-xit-01!sn-post-01!supernews.com!corp.supernews.com!not-for-mail
From: Christopher Corbell <ccorbell@vernier.com>
Newsgroups: comp.sys.mac.programmer.codewarrior,codewarrior.mac
Subject: CW "Map newlines to CR" chaos
Date: Wed, 06 Mar 2002 17:03:12 -0800
Organization: Posted via Supernews, http://www.supernews.com
Message-ID: <3C86BC4F.9930D425@vernier.com>
X-Mailer: Mozilla 4.77C-CCK-MCD {C-UDP; EBM-APPLE} (Macintosh; U; PPC)
X-Accept-Language: en
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Complaints-To: newsabuse@supernews.com
Lines: 29