home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Frostbyte's 1980s DOS Shareware Collection
/
floppyshareware.zip
/
floppyshareware
/
GLEN
/
IS.ZIP
/
NUM_CMP.C
< prev
next >
Wrap
C/C++ Source or Header
|
1988-10-26
|
479b
|
27 lines
/*
** num_cmp - compare two 'numeric' strings, return -1 if str1 < str2
** 0 if str1 == str2, 1 if str1 > str2
** return value can be tested the same way as if strcmp had been used
*/
#include <stdlib.h>
int num_cmp(char *str1, char *str2)
{
int ret;
long int num1, num2;
num1 = atol(str1);
num2 = atol(str2);
num1 -= num2;
if(num1 == 0)
return(0);
if(num1 > 0)
return(1);
else
return(-1);
}