PDA

View Full Version : how to write the run time on the window?



12-05-2003, 08:27 AM
Hello!

I need to show the run time in the graphic window. I'm trying with things like this:


static char label[50];
double time;
....
sprintf(label,"Tiempo = %8.3f ",time);
glRasterPos2f(10.0,10.0);
for (i = 0; i < 50; i++)
glutBitmapCharacter(GLUT_BITMAP_HELVETICA_10,label[i]);


but "sprintf" is not recognized during the compilation.

Does anyone knows if I need to add any other library?

Thank you.

ZbuffeR
12-05-2003, 08:32 AM
Originally posted by nusuto:
but "sprintf" is not recognized during the compilation.


Try to do :

#include <stdio.h>
#include <stdlib.h>

If it does not work, try to post your compiler/langage etc.

nexusone
12-05-2003, 09:09 AM
Yeah I think sprintf is part of the stdlib.h


Originally posted by ZbuffeR:
Try to do :

#include <stdio.h>
#include <stdlib.h>

If it does not work, try to post your compiler/langage etc.

12-09-2003, 06:23 AM
Thank you both. I put

#include <stdio.h>

and there were no problems!!