Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

adapting console code to a gui

Status
Not open for further replies.

sleze

Programmer
Jun 15, 2005
7
0
0
US
I got a nice bit of code running very smoothly on the console and now have to implement the gui. The problem is that printf() doesn't seem to work too well without a target for output.

Would anyone be able to point me to a site that explains how to redirect the output to an mfc control(like a text box or something)?
 
If you have access to CodeWarrior, create it as a WinSioux application instead of a console application. You don't have to change any printfs and everything appears in a scrollable window.
 
you can use sprintf instead to print to a destination buffer then set the text of the control to the buffer's contents.

Code:
int i = 5;
char buf[32];
sprintf(buf, "The number is %d", i);
SetWindowText(hWnd, buf);
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top