Hi,
I'd like to open file once but read it several times from start to end. Do you need a new QTextStream for every read (as shown below), or is it possible to reset the the stream? I have tried flush() and reset() but they won't do it.
char mystring[100]; char mystring2[100];
QFile infile
(""myfile.
txt"); if(!infile.open(QIODevice::ReadOnly | QIODevice::Text)) {exit(1);}
QTextStream in_stream(&infile);
QTextStream in_stream2(&infile);
in_stream >> mystring;
in_stream2 >> mysting2;
infile.close();
char mystring[100]; char mystring2[100];
QFile infile(""myfile.txt"); if(!infile.open(QIODevice::ReadOnly | QIODevice::Text)) {exit(1);}
QTextStream in_stream(&infile);
QTextStream in_stream2(&infile);
in_stream >> mystring;
in_stream2 >> mysting2;
infile.close();
To copy to clipboard, switch view to plain text mode
Bookmarks