home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Power-Programmierung
/
CD1.mdf
/
xbase
/
library
/
clipper
/
rettig
/
source
/
dec.c
< prev
next >
Wrap
C/C++ Source or Header
|
1990-10-21
|
675b
|
32 lines
/*********
*
* DEC.C
*
* by Ralph Davis
*
* Placed in the public domain by Tom Rettig Associates, 10/22/1990.
*
* Syntax: DEC( <expC> )
* Return: Decimal equivalent of hexadecimal string <expC>
*********/
#include "trlib.h"
TRTYPE dec()
{
char *s;
if ( PCOUNT == 1 && ISCHAR(1) )
{
s = _parc(1);
if (_tr_strlen(s) <= 4) /* If four characters in string,
convert to integer */
_retnd((double) _tr_htoi(s));
else /* Otherwise, convert to long */
_retnd((double) _tr_htol(s));
}
else
_retnd( (double)ERROR );
}