home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
DP Tool Club 8
/
CDASC08.ISO
/
NEWS
/
677
/
TSRTOOLS
/
ATOL.C
< prev
next >
Wrap
C/C++ Source or Header
|
1993-10-07
|
500b
|
38 lines
/*
atol.C
Copyright (C) 1993, Geoff Friesen B.Sc.
All rights reserved.
*/
#define INCL_ATOL
#ifndef INCL_ISDIGIT
#include "isdigit.C"
#endif
#ifndef INCL_ISSPACE
#include "isspace.C"
#endif
long atol (const char *s)
{
long num, sign = 1;
while (isspace (*s))
s++;
if (*s == '+')
s++;
else
if (*s == '-')
{
s++;
sign = -1;
}
for (num = 0; isdigit (*s); s++)
num = 10*num+*s-'0';
return sign*num;
}