Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

itoa(3C)

strtod(3C)

strtol(3C)

scanf(3S)

atof(3C)

NAME

atof, atoi, atol − convert ASCII to numbers

SYNOPSIS

double atof (nptr)
char ∗nptr;

int atoi (nptr)
char ∗nptr;

long atol (nptr)
char ∗nptr;

DESCRIPTION

These functions convert a string pointed to by nptr to floating, integer, and long integer representation respectively.  The first unrecognized character ends the string. 

atof recognizes an optional string of spaces, then an optional sign, then a string of digits optionally containing a decimal point, then an optional ‘e’ or ‘E’ followed by an optionally signed integer. 

Atoi and atol recognize an optional string of spaces, then an optional sign, then a string of digits. 

SEE ALSO

itoa(3C), strtod(3C), strtol(3C), scanf(3S). 

DIAGNOSTICS

In the att universe, if the correct result of atof would cause overflow, ±HUGE is returned (according to the sign of the value), and errno is set to ERANGE.  If the correct value would cause underflow, zero is returned and errno is set to ERANGE. 

BUGS

Other than the single case mentioned above, overflow conditions are ignored. 

CX/UX Programmer’s Reference Manual

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