[Qt-interest] stdout in a Visual Studio compiled GUI application

Mike Inman mangocats at gmail.com
Fri May 1 02:47:07 CEST 2009


Thanks Marco,

I'm assuming that if I already have a cmd.exe "shell" open and run a 
batch file in it, and the batch file calls my Qt app, that the output of 
the Qt app to this kind of "new" console you have described won't be 
captured in the piped output of my batch file?

I guess what I'm leaning toward right now is a global variable "file 
*msgOutfile;" and on linux it will be set to stdout and everything will 
work as it does now, but in Windows I'll be opening a file with a fixed 
name and then in the batch file after every call to the program I will 
send the contents of that file to the output of the batch file.... seems 
like there should be something more elegant, but I guess this is 
Windows, after all.

Mike

Marco Borm wrote:
> Hi Mike,
>
> I don't think you can attach a GUI application to a existing 
> console-window or start it "within".
> In the past I've done something similar by creating my own console 
> windows if a parameter "--console" was given to the application.
> Please read this for informations how to create a console windows:
> http://msdn.microsoft.com/en-us/library/ms682528(VS.85).aspx
>
>
> Greetings,
> Marco
>
> Mike Inman wrote:
>   
>> Hi,
>>
>> I have a GUI app that has a little bit of self-test diagnostics built
>> into it. When building/running/testing under Linux, the app is called
>> repeatedly from a bash script and the diagnostics do their output to
>> stdout (printf, etc.) piped to log files.
>>
>> I'd like to build something similar to work with the Visual Studio 2008
>> compiler, called from a batch file, output piped to log files, etc.
>> Unfortunately, stdout seems to be piping to a black hole unless I add
>> console to the .pro file, and I don't want a console window to open when
>> the app opens (basically, I want it to function like it does under
>> Linux, where the stdout will be seen _if_ the app was launched from a
>> command line, and is invisible otherwise, actually, otherwise doesn't
>> matter because nothing is sent to stdout if the app is functioning
>> normally.)
>>
>> So, is there a convenient mechanism that works in both environments?  I
>> could switch everything over to output to dedicated files, but that's
>> not very convenient in the bash script world....
>>
>> Thanks,
>>
>>
>> _______________________________________________
>> Qt-interest mailing list
>> Qt-interest at trolltech.com
>> http://lists.trolltech.com/mailman/listinfo/qt-interest
>>
>>   
>>     
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
>
>   




More information about the Qt-interest-old mailing list