How do I set a new QTextStream in the header, like this
MainClass{
private:
QTextStream out;
}
Then, in initialization set the file, so instead of
QTextStream out(&file), I would hope for something like
out.setFile(&file), but there's no .setFile in QTextStream
I found that QFile is an QIODevice, so QTextStream::setDevice(&QFile) will work.
Thus, now I have
MainClass{
private:
QTextStream out;
QFile file;
void writetoBuffer();
}
void MainClass::writetoBuffer(){
file.setFileName("bingbong.txt");
out.setDevice(&file);
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With