[Qt-interest] stdout of MSWin GUI application run from console

Paul Miller paul at fxtech.com
Wed Apr 13 17:20:38 CEST 2011


On 4/13/2011 10:16 AM, Rainer Wiesenfarth wrote:
> Am 13.04.2011 16:54, schrieb Paul Miller:
>> [...]
>> This was my point. I only want the console output when the app is run
>> from a console. When run from the GUI, I don't want the console popping
>> up. I haven't been able to find a reliable way to make a Qt app on
>> Windows that behaves like a console app when run from the console (ie.
>> prints stuff to the console), and a GUI app when run from Explorer.
>
> To me, this would make _two_ applications, probably sharing a large
> amount of code.

Yep - this was what I said originally. I do have TWO apps - one intended 
to run from a console, the other intended to run from the UI. They share 
a good deal of (non-UI) code.

For the Linux/Mac version of my app, the "console" version of the app is 
a symlink to the UI version. In main() I check argv[0], and if the name 
of the app is the symlink name, I run in "console mode", otherwise I run 
in "gui mode".



More information about the Qt-interest-old mailing list