View Full Version : How do I output text to the prompt window as in a normal C program?

11-14-2003, 03:50 PM
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(...)


11-15-2003, 07:17 AM
I tried printf and then one of my variables as an argument and it crashed teh program.

11-15-2003, 08:01 AM
How do you create your window? (GLUT, Win32 API, Something else) What's your OS? (Windows, Linux). Post some code.

11-15-2003, 08:13 AM
I'm in Windows using GLUT. I used printf(currentsign);
which is just a char and it blew the program up.
void myinit(void)


/* 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);

11-15-2003, 08:25 AM
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:

char str[50];
int someInt = 5;

sprintf(str, "The Int is: %d", someInt);
printf("%s", str);

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).]

11-15-2003, 06:52 PM
yes, the variable is initialized