C++ programming: keeping count of data items read from file
- From: "H.S." <hs.samix@xxxxxxxxx>
- Date: Tue, 06 May 2008 12:42:01 -0400
Hello,
In a C++ program I am reading a data file for later processing and computations. While reading that data file, I want to keep track of data items (doubles) read.
The data file is just a text file with N lines with C doubles in each line (N and C are known a priori). For now, I just read from the file stream in to a 2D array variable by reading each double at a time.
Now I am trying to introduce some sanity checking into this reading block. Here is what I am trying to do:
1. Verify how many doubles I have read in each line. Must be C. If they are not C, then the input file is corrupt.
2. Verify that the total number of data items are NxC. This is simple, I just keep a track of how many numbers I have read.
So, how do I go about doing (1) above? I was thinking of somehow checking if I have reached the end of line somehow (EOL?) but haven't found a method to do so. All I have found is EOF.
thanks,
->HS
--
To UNSUBSCRIBE, email to debian-user-REQUEST@xxxxxxxxxxxxxxxx with a subject of "unsubscribe". Trouble? Contact listmaster@xxxxxxxxxxxxxxxx
- Follow-Ups:
- Re: C++ programming: keeping count of data items read from file
- From: Mark Allums
- Re: C++ programming: keeping count of data items read from file
- From: Jordi Gutiérrez Hermoso
- Re: C++ programming: keeping count of data items read from file
- From: Ron Johnson
- Re: C++ programming: keeping count of data items read from file
- Prev by Date: Re: Illegal locales?
- Next by Date: Re: Re: Re: Can't resolve ftp.us.debian.org
- Previous by thread: formail -D 524608 msgid.cache does not work
- Next by thread: Re: C++ programming: keeping count of data items read from file
- Index(es):
Relevant Pages
|