What do u wants to do?
What do u wants to do?
Anurag Shukla
A man who never makes mistake is the man who never does anything! Theodre Rosvelt!
QTextStream::flush() flushes write buffer so don't expect it to do anything on a read only buffer. But I think I can see your point. You're saying that QTextStream::setDevice() should reset text stream's internal position, right?
J-P Nurmi
Ok seems that I do not explain the point, my fault.
If you run the prog you will notice that the out put will be this:
#include <QtCore>
This one will not work
First line: #include <QtCore>
This one will work
First line: ** If you read this line the QTextStream class works **
Closing the first file and opening another one does not affect QTextStream buffer until seek(0) is called.
If flush() is intended for write only, how could we delete the buffer when we open another file?
the answer seems to be "call seek(0)";
If you make a prog that ask for a file via QfileDialog, read the first line of the file using QTextStream:: readLine() and display it in a TextEdit. changing the file will not change the TextEdit contents because QTextStream::readLine() continue to read the same data.
QTextStream::readAll() is not affected.
Any comments are welcome.
Bookmarks