[Qt-interest] connect stdout to QTextStream

Alexander Poddey alexander.poddey at gmx.net
Wed Aug 19 10:11:18 CEST 2009


Hi all,

I'm new to qt. If this is not the correct place for my quetsion, please point 
me there.


I can connect stdout / stderr to a QTextStream using the constructor as 
follows:

QTextStream outStream(stdout);

but what about a situation where I want to have outStream be defined in a 
header file and later connect it - either to a file:


QTextStream outStream;

QString outFilePath="filename.txt" //could be given during runtime
outStream.setString(&outFilePath, QIODevice::WriteOnly);

or to stdout:
QString outFilePath="stdout" //could be given during runtime
//how to connect stdout here to previously defined outStream ?


thx
alex



More information about the Qt-interest-old mailing list