is there a way to set the istream back to the begining of the file?
Printable View
is there a way to set the istream back to the begining of the file?
my appologies, i meant ifstream, and i think seekg may be the answer, but i have got to go out, i will post my result for any who are interested.
Yes, use seekg but you will likely also need to use clear first.
Code:ifstream input;
string data;
// Read until end of stream
do
{
getline(input,data);
// Do stuff
} while( !input.eof() );
// Seek back to beginning of stream
input.clear();
input.seekg(0L,ios::beg);
// Do more stuff with input stream
my friend, thank you for the pointer on Clear().... you saved me from redesigning a vb interface at the last minute.