Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ strtol(3C) — sys5 — Apollo Domain/IX SR9.5

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

ctype(3C)

scanf(3S)

strtod(3C)



STRTOL(3C)               DOMAIN/IX SYS5                STRTOL(3C)



NAME
     strtol, atol, atoi - convert string to integer

USAGE
     long strtol(str, ptr, base)
     char *str, **ptr;
     int base;

     long atol(str)
     char *str;

     int atoi(str)
     char *str;


DESCRIPTION
     Strtol returns as a long integer the value represented by
     the character string that str points to.  The string is
     scanned up to the first character that is inconsistent with
     the base.  Leading "white-space" characters (as defined by
     isspace in ctype(3C)) are ignored.

     If the value of ptr is not (char **)NULL, a pointer to the
     character terminating the scan is returned in the location
     pointed to by ptr.  If no integer can be formed, that loca-
     tion is set to str, and zero is returned.

     If base is positive (and not greater than 36), it is used as
     the base for conversion.  After an optional leading sign,
     leading zeros are ignored, and "0x" or "0X" is ignored if
     base is 16.

     If base is zero, the string itself determines the base as
     follows. After an optional leading sign, a leading zero
     indicates octal conversion.  A leading "0x" or "0X" indi-
     cates hexadecimal conversion.  Otherwise, decimal conversion
     is used.

     Truncation from long to int can, of course, take place upon
     assignment or by an explicit cast.

     Atol(str) is equivalent to

       strtol(str, (char **)NULL, 10)

     and atoi(str) is equivalent to

       (int) strtol(str, (char **)NULL, 10)





Printed 12/4/86                                          STRTOL-1







STRTOL(3C)               DOMAIN/IX SYS5                STRTOL(3C)



NOTES
     Overflow conditions are ignored.

RELATED INFORMATION
     ctype(3C), scanf(3S), strtod(3C)
















































STRTOL-2                                          Printed 12/4/86





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