2
* convert unsigned long to ASCII
3
* Copyright (C) 1998, 1999 Henry Spencer.
5
* This library is free software; you can redistribute it and/or modify it
6
* under the terms of the GNU Library General Public License as published by
7
* the Free Software Foundation; either version 2 of the License, or (at your
8
* option) any later version. See <http://www.fsf.org/copyleft/lgpl.txt>.
10
* This library is distributed in the hope that it will be useful, but
11
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
13
* License for more details.
15
* RCSID $Id: ultoa.c,v 1.7.36.1 2004/03/21 05:23:31 mcr Exp $
21
- ultoa - convert unsigned long to decimal ASCII
23
size_t /* length required for full conversion */
24
ultoa(n, base, dst, dstlen)
27
char *dst; /* need not be valid if dstlen is 0 */
30
char buf[3*sizeof(unsigned long) + 1];
31
char *bufend = buf + sizeof(buf);
34
static char hex[] = "0123456789abcdef";
43
} else if (base == 16) {
50
} else if (base == 8) {
63
*(p + dstlen - 1) = '\0';