How do I convert a long to a string in C++?
long
string
The way I typically do it is with sprintf. So for a long you could do the following assuming that you are on a 32 bit architecture:
char buf[5] = {0}; // one extra byte for null sprintf(buf, "%l", var_for_long);