Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ itoa(3C) — DG/UX R4.11MU05

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

reentrant(3)

atoi(3C)

sprintf(3S)



itoa(3C)                       DG/UX R4.11MU05                      itoa(3C)


NAME
       itoa - convert an integer to an ASCII character string

SYNOPSIS
       char *itoa(int num, char *string);

   where:
       num     Value of type int
       string  A byte pointer to a character array

DESCRIPTION
       The itoa function converts an integer to an ASCII string.  If num is
       negative, the string will contain a minus sign, one to 10 digits, and
       a null.

       The maximum number of characters itoa returns is 13.


   Considerations for Threads Programming
                     +---------+-----------------------------+
                     |         |                      async- |
                     |function | reentrant   cancel   cancel |
                     |         |             point     safe  |
                     +---------+-----------------------------+
                     |itoa     |     Y         N        N    |
                     +---------+-----------------------------+

EXAMPLE
       #include <stdio.h>
       #define STRINGMIN 13

       int i = 1, num;
       char string[STRINGMIN], *itoa(int, char *);

       main(argc, argv)
       int argc;
       char *argv[];
       {
            while (i < argc) {
                 num = atoi(argv[i]);
                 num *= i;
                 itoa(num, string);
                 printf("%s\n", string);
                 i++;
            }
            return 0;
       }

       A call to the program test with the numbers 1, 2, 3, and 4 generates
       the output

       1
       4
       9
       16

RETURN VALUE
       Address The address of the string returned

SEE ALSO
       reentrant(3), atoi(3C), sprintf(3S).


Licensed material--property of copyright holder(s)

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026