Atoi, Atol, Bsearch – Zilog EZ80F916 User Manual
Page 356: Atoi atol bsearch

UM014423-0607
C Standard Library
ZiLOG Developer Studio II
eZ80Acclaim!
®
User Manual
336
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(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 behav-
ior on error, it is equivalent to
strtol(nptr, (char **)NULL, 10)
.
Synopsis
#include
long int atol(char *nptr);
Returns
The converted value.
Example
char str[]="1234567";
long int x;
x=atol(str);
bsearch
Searches an array of nmemb objects, the initial member of which is pointed to by base, for
a member that matches the object pointed to by key. The size of each object is specified by
size.
The array has been previously sorted in ascending order according to a comparison func-
tion pointed to by
compar
, which is called with two arguments that point to the objects
being compared. The
compar
function returns an integer less than, equal to, or greater