9bafc8aa7b
git-svn-id: svn://kolibrios.org@6412 a494cfbc-eb01-0410-851d-a64ba20cac60
23 lines
380 B
C
23 lines
380 B
C
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <ctype.h>
|
|
#include <string.h>
|
|
|
|
/*
|
|
** itoa(n,s) - Convert n to characters in s
|
|
*/
|
|
char* itoa(int n,char* s)
|
|
{
|
|
int sign;
|
|
char *ptr;
|
|
ptr = s;
|
|
if ((sign = n) < 0) n = -n;
|
|
do {
|
|
*ptr++ = n % 10 + '0';
|
|
} while ((n = n / 10) > 0);
|
|
if (sign < 0) *ptr++ = '-';
|
|
*ptr = '\0';
|
|
return strrev(s);
|
|
}
|
|
|