[Qt-interest] connect stdout to QTextStream
Alex
shao.tu at gmail.com
Wed Aug 19 10:23:02 CEST 2009
For a file:
QFile file(outFilePath);
file.open(QFile::WriteOnly);
outStream.setDevice(&file);
But I don't know how to achieve your goal for stdout.
2009/8/19 Alexander Poddey <alexander.poddey at gmx.net>
> 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
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090819/208d9c8b/attachment.html
More information about the Qt-interest-old
mailing list