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

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



> I have some one problem to convert one integer to string on C under
> Linux. On Borland C, we can use itoa() command.
> 
> If any one have the such header file or patch, would you like to send me
> the copy?
> 

Maybe try something like this but check if the result fits into string.


#include <stdio.h>

int
itoa(char *string, int d)
{

    if(string) {
        return sprintf(string, "%d", d);
    }
    return -1;
}



Greetings,

    Till!


--- [rtl] ---
For more information on Real-Time Linux see:
http://rtlinux.cs.nmt.edu/

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