[CSI] File IO Question
Mikhail Nesterenko
mikhail at cs.kent.edu
Wed May 4 12:40:13 EDT 2022
Joshua Romisher wrote:
> Dr. Nesterenko,
>
> For File IO, when reading in a loop, what is the 'myvar' parameter listed
> in the example on slide 3 for File IO while (fin >>myvar) and
> while(getline(fin,myvar)).
>
the semantics is that getline()/extraction operator is true if the
reading was successful, i.e. the end of the file is not reached. That
is, this while-loop keeps reading into myvar until the end of the file
is reached.
Example usage is here:
http://www.cs.kent.edu/~mikhail/classes/csi/Examples/Io/printFileExtr.cpp
and here:
http://www.cs.kent.edu/~mikhail/classes/csi/Examples/Io/printfile.cpp
Thanks,
--
Mikhail
More information about the cs13001
mailing list