printf not working in wx

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
Qasim
Knows some wx things
Knows some wx things
Posts: 29
Joined: Wed May 23, 2007 3:41 pm
Location: London

printf not working in wx

Post by Qasim » Fri Mar 14, 2008 10:28 am

Hi. I am not sure if its wx related.
I am trying to use printf("myfar %i",myvar); in a sample wx project but nothing appears in output window, any hints
PS: cout<< does not work either
Thanks
Who doubts nothing, Knows nothing

cr0nholio
Knows some wx things
Knows some wx things
Posts: 29
Joined: Wed Sep 12, 2007 8:54 am

Post by cr0nholio » Fri Mar 14, 2008 10:41 am

Did you try running the executable from the command line?

Auria
Site Admin
Site Admin
Posts: 6695
Joined: Thu Sep 28, 2006 12:23 am
Contact:

Post by Auria » Fri Mar 14, 2008 11:39 am

This is not a wx question, printf calls don't go through wx, just to your system :wink: make asure you run from terminal and have a way to see the program's output

AND: try adding a line breask (\n) at the end of printf. or using flush. Or use std::cout << "something" << std::endl; often nothing will display until one line is complete or flushed

mc2r
wxWorld Domination!
wxWorld Domination!
Posts: 1195
Joined: Thu Feb 22, 2007 4:47 pm
Location: Denver, Co
Contact:

Post by mc2r » Fri Mar 14, 2008 7:55 pm

Auria wrote:This is not a wx question, printf calls don't go through wx, just to your system :wink: make asure you run from terminal and have a way to see the program's output
Qasim doesn't mention platform, but on windows you can't just printf or cout to the console. You have to add some wxWidgets so it is a console app and the console will connect to stdin, stdout and stderr. Unfortunatly, off the top of my head I don't remember what. If Qasim is building for win32 I'll look for the code.

I suspect the problem might be though that Qasim isn't running from a console as Auria suggests.
Qasim wrote: am trying to use printf("myfar %i",myvar); in a sample wx project but nothing appears in output window
Qasim, what is the output window a console that you ran the application from or a wxWindow/wxFrame that the application creates? Also, what platform are you building for.

-Max

mc2r
wxWorld Domination!
wxWorld Domination!
Posts: 1195
Joined: Thu Feb 22, 2007 4:47 pm
Location: Denver, Co
Contact:

Post by mc2r » Fri Mar 14, 2008 8:21 pm


Post Reply