I'm trying to get my Frames-Per-Second readout to appear in my window title. I have done it once before, but how would I set up the code to do that? I need to switch from float to const char *.
Asked
Active
Viewed 1,217 times
2 Answers
3
A simple way to do, and making it compatible with every numerical could be that:
#include <sstream>
template<class T>
char* toChar(T t) {
std::ostringstream oss;
oss << t;
return oss.str().c_str();
}
This way, no matter if you use int, float, long or whatever else, it will work and return it as a char* string.

Keith Layne
- 3,688
- 1
- 24
- 28

Rosme
- 1,049
- 9
- 23