Advertisement

How do use glPrint() to print a string var

Started by April 15, 2008 11:41 AM
1 comment, last by daviddiligent 16 years, 7 months ago
Hey guys say is I have a std::string s="hello world". How would I possible to print it using glPrint() This code doesn't work btw

glPrint(10,10,1,"string is :%s",s);

/*----------------------------------------------------------------------------------------------------------------------------------*/Enthusiastic and wild about game development. Any opportunity would get me sink into any fantastic game-revolution era.
glPrint(10,10,1,"string is :%s",s);
Should be:
glPrint(10,10,1,"string is :%s",s.c_str());

Otherwise you're splattering in the member variables of the string class.
Advertisement
Quote: Original post by Evil Steve
glPrint(10,10,1,"string is :%s",s);
Should be:
glPrint(10,10,1,"string is :%s",s.c_str());

Otherwise you're splattering in the member variables of the string class.


Yes Thanks a lot mate.
/*----------------------------------------------------------------------------------------------------------------------------------*/Enthusiastic and wild about game development. Any opportunity would get me sink into any fantastic game-revolution era.

This topic is closed to new replies.

Advertisement