Atoi, Atol, Atoi atol – Zilog ZUSBOPTS User Manual
Page 439: Example, Synopsis, Returns

UM017105-0511
Standard Functions
Zilog Developer Studio II – ZNEO™
User Manual
411
Example
char str []="1.234";
double x;
x= atof(str);
atoi
Converts the string pointed to by nptr to int representation. Except for the behavior on
error, it is equivalent to
(int)strtol(nptr, (char **)NULL, 10)
.
Synopsis
#include
int atoi(const char *nptr);
Returns
The converted value.
Example
char str []="50";
int x;
x=atoi(str);
atol
Converts the string pointed to by nptr to long int representation. Except for the behavior
on error, it is equivalent to
strtol(nptr, (char **)NULL, 10)
.
Synopsis
#include
long int atol(const char *nptr);
Returns
The converted value.
Example
char str[]="1234567";
long int x;
x=atol(str);