writing, please its urgent

I need to read the integers from a file and print it.
I know how to read but not how to comvert int to char*.

my printing function goes like:

void glutPrint(float x, float y, LPVOID font, char *text, float red, float green, float blue) // text printing function
{
    if(!text || !strlen(text)) return;
    bool blending = false;
    if(glIsEnabled(GL_BLEND)) blending = true;
    glEnable(GL_BLEND);
    glColor3f(red,green,blue);
    glRasterPos2f(x,y);
    while (*text) {
        glutBitmapCharacter(font, *text);
        text++;
    }
    if(!blending) glDisable(GL_BLEND);
}

coding in c++ using glut

There’s the standard C function sprintf(), or in C++11 there’s std::to_string().

Warning: incoming rant.[/b]

Stop suggesting people use sprintf! At least 50% of all buffer overflow attack vectors come from using that function. It should never be used by anyone for anything.

If you don’t like std::stringstream (and I can understand why), then use s[b]n[/b]printf. If you’re using Visual Studio, then you have to use _snprintf. Either way, there’s no excuse for using a function as broken as sprintf.

End of rant[/b]

In any case, this page by Herb Sutter covers pretty much every way (pre-C++11) to turn a number into a string. Oh, and you may notice that turning a number into a string has nothing to do with OpenGL.

Yes I understand that lol.

I got it to work this way:

stringstream conv1,conv2,conv3,conv4;
    conv1 << stats.played;   

    glutPrint(1.5, 3,GLUT_BITMAP_TIMES_ROMAN_24, const_cast<char*>(conv1.str().c_str()), 1.0, 1.0, 1.0);

sorry about asking this question here.

Converting intiger to string