home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!dtix!darwin.sura.net!jvnc.net!yale.edu!yale!gumby!destroyer!sol.ctr.columbia.edu!The-Star.honeywell.com!umn.edu!epx.cis.umn.edu!wright
- From: wright@epx.cis.umn.edu (Mark Wright)
- Newsgroups: comp.lang.c++
- Subject: Bizarre Borland stream bug
- Message-ID: <1992Jul30.185327.662@news2.cis.umn.edu>
- Date: 30 Jul 92 18:53:27 GMT
- Sender: news@news2.cis.umn.edu (Usenet News Administration)
- Organization: University of Minnesota
- Lines: 62
- Nntp-Posting-Host: epx.cis.umn.edu
-
- OK, now this is REALLY silly. I'm compiling the following program
- under Borland C++ v3.1. All it does is read in a file with the format
- given below. It looks like borland's stream class DOESN'T LIKE THE
- NUMBER NINE!!! Am I doing something weird, is this the compiler, or
- should I call in an exorcist...
-
-
- #include<iostream.h>
- #include<fstream.h>
-
- struct PointRecord {
- int pointno;
- double x;
- double y;
- };
-
-
- void main( int argc, char *argv[] )
- {
- PointRecord point;
- ifstream inFile( argv[1], ios::in );
-
- for (;;) {
- if (!(inFile >> point.pointno))
- break;
- if (!(inFile >> point.x))
- break;
- if (!(inFile >> point.y))
- break;
-
-
- cout << point.pointno << ": "
- << point.x << ", "
- << point.y << endl;
- }
- }
-
-
- /*
- FILE 1:
- 0001 111111.1111 111111.1111
- 0009 222222.2222 222222.2222
-
- PROGRAM OUTPUT:
- 1: 111111.1111, 111111.1111
- 0: 9, 222222.2222
-
-
- FILE 2:
- 0009 222222.2222 222222.2222
- 0001 111111.1111 111111.1111
-
- PROGRAM OUTPUT:
- 0: 9, 222222.2222
- 25614: 0.2222, 1
- -19961: 0.1111, 111111.1111
- */
-
-
-
- Mark Wright
- wright@epx.cis.umn.edu
-