On (11 Oct 97) Jack Everett wrote to All...
JE> I have a sequential file that I have created...but I would like to
JE> read in the file then break down each line into variable..is this
JE> possible or do I need to go Random file...
As far as C++ cares, there's no such thing as a file being random or
sequential - there are just files, and you can access any of them
randomly or sequentially.
In this case, you'd do something like this:
string lines[max_lines];
ifstream input("input_file.txt");
for ( int i=0; i < max_lines && !input.bad(); i++)
input >> lines[i];
Depending upon how new it is, your compiler may not support the `string'
data type, in which case you'll have to read your lines into buffers of
characters.
Later,
Jerry.
--- PPoint 2.02
---------------
* Origin: Point Pointedly Pointless (1:128/166.5)
|