[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [OT] C++ programming: keeping count of data items read from file



On Tue, May 6, 2008 at 1:50 PM, H.S. <hs.samix@gmail.com> wrote:
>  As I mentioned earlier, the issue is how do I count items read in one line,
> or before the next EOL? Counting total items is not a problem.
>
>  Perhaps a different way to say this is, how do I detect if I have reached
> an EOL while reading doubles from a file stream.

Can you read full lines out into, eg, a stringstream, and parse your
doubles out of that?  You'd hit an EOF at the end of each line in that
case.  I'm not sure how you'd get stream out line-at-a-time, though
there may be a stream operator that sets the appropriate behavior.

Just a random idea off the top of my head.

-- 
Michael A. Marsh
http://www.umiacs.umd.edu/~mmarsh
http://mamarsh.blogspot.com
http://36pints.blogspot.com


Reply to: