[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: [rtl] itoa(s,ct) command



On Mon, 29 Jun 1998, Adolf Ahmad MS wrote:
> I have some one problem to convert one integer to string on C under
> Linux. On Borland C, we can use itoa() command.

You can try using sprintf(3) and sscanf(3) for converting between
integers and strings.

   /* Convert from integer to string */
   sprintf(TargetString, "%d", SourceInteger);

   /* Convert from string to integer */
   /* Note the '&'. Easy to forget, hard to see. */
   sscanf(SourceString, "%d", &TargetInteger);  


Vegard


-- 
Vegard Bakke     | My spelling is Wobbly. It's good spelling but it
Knox College     | wobbles, and the letters get in the wrong places.
Opoho, Dunedin   |                                   Winnie the Pooh
New Zealand      |
The Land of BÊÊÊ |     http://atlas.otago.ac.nz:800/~vbakke/

--- [rtl] ---
For more information on Real-Time Linux see:
http://www.rtlinux.org/