Posted by William D McQuain on November 12, 2001 at 07:55:02:
In Reply to: reading vehicle data eof posted by Glick on November 11, 2001 at 15:01:14:
: for reading each set of data (license, manufacturer, model, year) in to their own arrays, i planned on using 4 different functions, using the eof member function reading to the end of the file.
Hm... that's bad for a couple of reasons (if I'm reading you intent correctly). It sounds as if you'd be reading the file 4 times, that is making 4 passes through it, presumably ignoring different things on each pass.
That's inefficient since it can be done in a single pass, ignoring nothing.
Second, be careful about your plan to read to EOF. You may be missing something in the spec.
however, after reading to the end of the file, im assuming the stream is then useless for the other functions. Is there a way to reset the stream for the other functions to use the same stream? stream.clear(); ?
Post a Followup