Hey everyone,
I'm trying to figure out how to convert from an Integer or a Double into a string.

I want a string variable to print out on a command line.

Thanks for any help.

- WolfShield

7 Years
Discussion Span
Last Post by rubberman

Why convert to string? If you want to print to terminal, just output it to cout, as in:

int i = 999;
cout << "i == " << dec << i << endl;


Thanks for the correction

Not a problem. We all get used to the goodies on our particular systems, often not considering if they are available elsewhere. After 30 years of serious cross-platform development (one code base, 10+ operating systems, 10M lines of code) I quickly learned that what works on one system, may either not work at all (not available), or function differently on another. It gets really fun when you are bit-twiddling and you switch from a big-endian to a little-endian (or vice versa) machine, or one where a long integer is 32 bits to one where it is 64 bits.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.