🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: alt.comp.lang.learn.c-c++
Article #572

Re: Summing a comma delinted file

#572
From: Chris ( Val )
Date: Mon, 24 Sep 2001 00:49
57 lines
2584 bytes
"Rich Churcher" <churcher@ihug.com.au> wrote in message news:m3sndd34om.fsf@ihug.com.au...
| "Chris \( Val \)" <chrisvalNOSPAM@NOSPAMbigpond.com.au> writes:
|
| > Hi Wayne, when using the bitwise operator to perform extraction,
|
| Er, that's the stream extraction operator :o)
|
|
| > it will terminate it's reading upon any whitespace it encounters and
| > then move to the next appropriate block of data.
|
| ...unless noskipws is used.

'OK'

| [ snip ]
| >     if (!instream)
| >       {
| >         cout << "Input file opening failed.\n";
| >         EXIT_FAILURE;
|
| Don't you mean,
|
|   exit( EXIT_FAILURE );
|
| ?

OOP's...

| >       }
| >
| >     if (!outstream)
| >       {
| >         cout << "Output file opening failed.\n";
| >         EXIT_FAILURE;
| >       }
| >
| >     while (!instream.eof( ))
|
| No, don't do that. eof() only returns true after there has been an
| attempt to read past the end of file. Instead, you can test for
| success or failure of the input operation:
|
|   while( getline( instream, Record[ Count ], ',' ) )
|   {
|     // ...

Thank's Rich, that looks much better.
Chris Val


| [ examples not compiled or tested ]
|
| --
| Cheers,  // First time posting?  READ THIS:
| Rich.    // http://snurse-l.org/acllc-c++/faq.html
Technical Details
Message-ID: <mqvr7.29260$c5.218244@newsfeeds.bigpond.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!intgwpad.nntp.telstra.net!newsfeeds.bigpond.com!not-for-mail
References: <5vgr7.27572$c5.208712@newsfeeds.bigpond.com> <DJir7.27761$c5.209698@newsfeeds.bigpond.com> <m3sndd34om.fsf@ihug.com.au>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 103c8d,a8ecdb8ba824bdd3
X-Google-Attributes: gid103c8d,public
X-Google-Thread: 114592,a8ecdb8ba824bdd3
X-Google-Attributes: gid114592,public
X-Google-ArrivalTime: 2001-09-23 17:51:31 PST
Path: arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!intgwpad.nntp.telstra.net!newsfeeds.bigpond.com!not-for-mail
From: "Chris \( Val \)" <chrisvalNOSPAM@NOSPAMbigpond.com.au>
Newsgroups: alt.comp.lang.learn.c-c++,borland.public.cppbuilder.language
References: <5vgr7.27572$c5.208712@newsfeeds.bigpond.com> <DJir7.27761$c5.209698@newsfeeds.bigpond.com> <m3sndd34om.fsf@ihug.com.au>
Subject: Re: Summing a comma delinted file
Lines: 59
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.50.4522.1200
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200
Message-ID: <mqvr7.29260$c5.218244@newsfeeds.bigpond.com>
Date: Mon, 24 Sep 2001 10:49:45 +1000
NNTP-Posting-Host: 203.54.65.142
X-Trace: newsfeeds.bigpond.com 1001292562 203.54.65.142 (Mon, 24 Sep 2001 10:49:22 EST)
NNTP-Posting-Date: Mon, 24 Sep 2001 10:49:22 EST
Organization: Telstra BigPond Internet Services (http://www.bigpond.com)