forked from KolibriOS/kolibrios
Added several functions (to ctype.h, stdlib.h)
"Optimised" some functions in string.h Added dynamic libraries support based on sysfunction 68.19 (experimental) git-svn-id: svn://kolibrios.org@215 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
21
programs/develop/metcc/trunk/libc/string/itoa.c
Normal file
21
programs/develop/metcc/trunk/libc/string/itoa.c
Normal file
@@ -0,0 +1,21 @@
|
||||
#include "stdio.h"
|
||||
#include "stdlib.h"
|
||||
#include "ctype.h"
|
||||
|
||||
/*
|
||||
** itoa(n,s) - Convert n to characters in s
|
||||
*/
|
||||
void 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';
|
||||
reverse(s);
|
||||
}
|
||||
|
Reference in New Issue
Block a user