Print score in SDL with opengl using ostream??

hello friends i am using the following code to print in SDL screen


SDL_GL_RenderText( timer, font, color, &position);
sprintf(timer," Time : %d",time);

to print in SDL screen(used with opengl) , i am doing project on C++, as "sprintf" is C style function , so i can't do like this , i am trying to use" ostringstream" , but i am not sure how to use it , plz somebody post the equivalent c++ style (using ostringstream or equivalent).
Thanks
1
2
3
4
std::ostringstream ss;
ss << "Time: " << time;
std::string timer = ss.str();
SDL_GL_RenderText(timer.c_str(), font, color, &position);
Topic archived. No new replies allowed.