utoa(3C)
_________________________________________________________________
utoa function
Convert an unsigned integer to a character string.
_________________________________________________________________
Calling Sequence
char *utoa();
unsigned num;
char *string;
utoa(num, string);
where num is the unsigned integer to convert.
string is a byte pointer to the string to hold the
number.
Description
The utoa function converts an unsigned integer to a character
string. It places a maximum of 11 digits and a trailing null
into the string.
The include file dg_stdio.h defines this function. It also
defines the macro L_utoa, which is the maximum number of
characters that utoa returns (12).
Returns
The utoa function returns the address of the string
representation of the number; i.e., it returns string.
Related Functions
See also the atou function.
Example
/* Program test for the utoa() function */
char place[12];
unsigned store, dim, atou(), utoa();
main(argc, argv)
int argc;
DG/UX 4.00 Page 1
Licensed material--property of copyright holder(s)
utoa(3C)
char *argv[];
{
store = atou(argv[1]);
dim = atou(argv[2]);
while (dim > 0) {
utoa(store--, place);
puts(place);
dim--;
}
}
A call to the program test with
x test 1984 5
generates the output
1984
1983
1982
1981
1980
DG/UX 4.00 Page 2
Licensed material--property of copyright holder(s)