int to string conversion

Martin Wiebusch marwie at gmx.net
Sat Feb 12 12:49:25 GMT 2000


Jerry L Kreps wrote:
> 
> Martin Wiebusch wrote:
> >
> > Hi,
> > i was just wondering whether there is a function to convert integer
> > values to strings in any of the libaries. I already tried itoa, Itoa and
> > IntToStr. I also noticed there ist an Itoa function defined in the
> > Integer.h header. But I don't really need an Integer class, just a
> > little function to convert usual int variables into strings.
> 
> You can use I/O manipulators (page 259, Practical C++
> programming)

Thankx, but I knew that Numbers are converted to strings when you write
them on stdout with cout << ...
What I want to do is writing that what in your examples appears on the
screen to a variable of the type "string".
Tilo Riemer just wrote me, that I can use "sprintf". But then I have to
guess how many digits number will have. So it would be great if there
was something like "sprintf" for instances of the string class. Any
idea?




More information about the KDevelop mailing list