home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Simtel MSDOS 1992 September
/
Simtel20_Sept92.cdr
/
msdos
/
c
/
lex.arc
/
INTEG.C
< prev
next >
Wrap
Text File
|
1986-03-03
|
506b
|
24 lines
/*
* integ -- ascii to long (various bases)
*/
long
integ(cp, base)
char *cp;
register int base;
{
register c;
long n;
n = 0;
while (c = *cp++) {
if (c>='A' && c<='Z')
c += 'a'-'A';
if (c>='a' && c<='z')
c = (c-'a')+10+'0';
if (c < '0' || c > base+'0')
break;
n = n*base + c-'0';
}
return(n);
}