Hi, I have a question regarding QFile and QTextStream. I know that normally we will use them like this:
Qt Code:
// print error return; } QTextStream outStream(&file); // create a QTextStream object which "link" to the QFile object "file"To copy to clipboard, switch view to plain text mode
my question is: can we use QTextStream alone? That is, instead of create a QFile first and then create a QTestStream pointing to that QFile, can we create a QTextStream directly from a file name and then read or write directly on this QTextStream object?
I used to use StreamWriter and StreamReader in C# and hope to have something similar in QT classes. So far, I have to always keep two objects, one QFile and one QTextStream, in order to read/write a file.
Thanks for any comment!
Bookmarks