02.07.2013 Views

A/UX® Programmer's Reference Sections

A/UX® Programmer's Reference Sections

A/UX® Programmer's Reference Sections

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

strtol(3C) strtol(3C)<br />

NAME<br />

strtol, atol, atoi - convert string to integer<br />

SYNOPSIS<br />

long strtol (str, plr, base)<br />

char *str, **plr;<br />

int base;<br />

long atol (str)<br />

char *str;<br />

int atoi (str)<br />

char *str;<br />

DESCRIPTION<br />

strtol returns as a long integer the value represented by the<br />

character string pointed to by sIr. The string is scanned up to the<br />

first character inconsistent with the base. Leading white-space<br />

characters (blanks and tabs) are ignored.<br />

If the value of plr is not (cha r * * ) NULL, a pointer to the character<br />

terminating the scan is returned in the location pointed to by<br />

plr. If no integer can be formed, zero is returned.<br />

If base is positive (and not greater than 36), it is used as the base<br />

for conversion. After an optional leading sign. leading zeros are<br />

ignored; a leading Ox or Ox is ignored if base is 16.<br />

If base is zero, the string itself determines the base. After an optionalleading<br />

sign, a leading zero indicates octal conversion and a<br />

leading Ox or OX indicates hexadecimal conversion; otherwise, decimal<br />

conversion is used.<br />

Truncation from long to int can take place upon assignment or<br />

by an explicit cast.<br />

atol (str) is equivalent to:<br />

strtol (str, (char **) NULL, 10)<br />

atoi (str) is equivalent to:<br />

(int) strtol (SIr, (char **)NULL, 10)<br />

SEE ALSO<br />

ctype(3C), scanf(3S), strtod(3C).<br />

February, 1990<br />

Revision C<br />

1

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!