I am trying to use a QTextStream object as a data member as follows:
[in .h file]
private:
private:
QTextStream *out;
To copy to clipboard, switch view to plain text mode
[in .cpp file]
return;
out << "test";
QFile file(fileName);
if (!file.open(QIODevice::Append | QIODevice::Text))
return;
out = new QTextStream(&file);
out << "test";
To copy to clipboard, switch view to plain text mode
...
but it has a compile time error
error: invalid operands of types `QTextStream*' and `const char[5]' to binary `operator<<'
I then modified it to
out = &o;
out << "test";
QTextStream o(&file);
out = &o;
out << "test";
To copy to clipboard, switch view to plain text mode
but still the same error.
Can someone please tell me the correct way to do this?
Bookmarks