View Full Version : How do I output text to the prompt window as in a normal C program?
I have no clue how to do this. I'm trying to debug my program and want to output the values in the array I'm using.
11-14-2003, 09:04 PM
printf("This goes to the console");
11-15-2003, 02:01 AM
Or if you have a non console app and you do have a debugger you can use OutputDebugString(...)
I tried printf and then one of my variables as an argument and it crashed teh program.
How do you create your window? (GLUT, Win32 API, Something else) What's your OS? (Windows, Linux). Post some code.
I'm in Windows using GLUT. I used printf(currentsign);
which is just a char and it blew the program up.
/* Pick 2D clipping window to match size of X window
This choice avoids having to scale object coordinates
each time window is resized */
glOrtho(0.0, (GLdouble) ww , 0.0, (GLdouble) wh , -1.0, 1.0);
/* set clear color to black and clear window */
glClearColor (0.8, 0.8, 0.8, 1.0);
printf is used as follows:
char currentsign = 'd'; //just a random letter to initialize the variable
printf("Print a character: %c", currentsign);
Also I find sprintf pretty handy sometimes:
int someInt = 5;
sprintf(str, "The Int is: %d", someInt);
especially when you want to print bitmap character 'n' stuff.
Anyway have you initialized you variable?
[This message has been edited by moucard (edited 11-15-2003).]
yes, the variable is initialized
Powered by vBulletin® Version 4.2.2 Copyright © 2015 vBulletin Solutions, Inc. All rights reserved.