how to write the run time on the window?

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.

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.

Yeah I think sprintf is part of the stdlib.h

Originally posted by ZbuffeR:
[b] Try to do :

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

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

Thank you both. I put

#include <stdio.h>

and there were no problems!!