2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS system libraries
4 * FILE: lib/crtdll/stdlib/itoa.c
5 * PURPOSE: converts a integer to ascii
9 * 1998: Added ltoa Boudewijn Dekker
11 /* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
12 #include <crtdll/errno.h>
13 #include <crtdll/stdlib.h>
14 #include <crtdll/internal/file.h>
17 itoa(int value, char *string, int radix)
26 if (radix > 36 || radix <= 1)
32 sign = (radix == 10 && value < 0);
37 while (v || tp == tmp)
48 string = (char *)malloc((tp-tmp)+sign+1);
61 ltoa(long value, char *string, int radix)
70 if (radix > 36 || radix <= 1)
76 sign = (radix == 10 && value < 0);
80 v = (unsigned long)value;
81 while (v || tp == tmp)
92 string = (char *)malloc((tp-tmp)+sign+1);
104 _ultoa(unsigned long value, char *string, int radix)
109 unsigned long v = value;
112 if (radix > 36 || radix <= 1)
119 while (v || tp == tmp)
126 *tp++ = i + 'a' - 10;
130 string = (char *)malloc((tp-tmp)+1);