Re: [Dev-C++] RE: Int value to string
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Gregor P. <Gre...@dl...> - 2000-12-07 11:11:58
|
Looks pretty good but what I need is a string not char[10] to feed needsStringFunc( string name) Are there any online documentation about stdlib.h and Co where I can look for myself? (For a function to convert an array of char to sting, for example?) :-) Gregor exc...@sp... wrote: > >How to convert, cast, transform, whatever a int value to a string? > First, include stdlib.h. > Then add another string to hold the myInt value: > char myApples[20]; > Then all you have to do is insert this line of code: > itoa(myInt, myApples, 10); > This line of code takes an int (myInt), and converts it to a string (myAples), with base 10. If you want the number in hex, write 16. If you want it in binary, write 2. |