|
| Oromis (73) | ||||
| Probably a commen question, but I can't find a good answer: how to convert an integer to a string? I came across several solutions. I can't get stringstream to work. The function sprintf() gave problems to, and it's c-style. The function itoa() worked fine, but the reference says
And this function is c-style to. I wrote my own c++-style function, and it works without problems:
Still, I would think there's a standard function (c++-style) available. If there isn't, can anyone give an example-code/link about how it's done stringstream? Thanks for any help! | ||||
| Bazzy (3164) | |||
with stringstream:
| |||
Last edited on | |||
| Oromis (73) | |
| Thanks Bazzy! I didnt know about the memberfunctions str(). I tried the construction that is used when converting string to integer, but that didnt work. This works great. | |
| jsmith (3099) | |||
Essentially does what Bazzy did, except this is 1 line of code (sometimes useful). | |||
This topic is archived - New replies not allowed.
