| C N V _ A T O U L O N G ( )
| | | | | SOURCE: qdev_autodocs.txt 1.163 (12/09/2014) English
INDEP - CNV_#?
----------------------------------------------------------------------------
NAME
cnv_AtoULONG() - Converts stringified number to integer.
SYNOPSIS
success = cnv_AtoULONG(string, value, flags);
LONG cnv_AtoULONG(UBYTE *, ULONG *, ULONG);
FUNCTION
This function is able to convert what 'cnv_ULONGtoA()'
is able to produce to ULONG or LONG integer.
INPUTS
string - NULL terminated string that contains a number.
value - Pointer to integer variable. It must be of the
size pointer is! Dont pass pointers to 'UBYTE',
or 'UWORD' sized datatypes or memory will be
trashed!!!
flags - Bases(2,8,10,16), see header file for defines.
If this is 0 then autodetection will be done.
RETURNS
Function will return -1 if converted value in negative.
0 will be returned if conversion failed and 1 if the
value is positive. Value of -666 will be returned if
there was an underflow and 666 for overflow.
BASES
None.
NOTES
This func. automagically determines hexadecimals who beg.
with '$' or '0x', octals who begin with 'q' or '0o' or
binaries who begin with '%' or '0b' prefixes. If it cant
determine type of number then defaults to decimal unless
'base' is not something else.
All notations mentioned above can be signed(macros for
handling signed datatypes exist).
Values can be aligned to as many zeroes as possible.
Please note that the binary conversion is the slowest,
but still several times faster when compared to 'ixemul's
'atoi()'.
UQUAD variant of this function exists.
SEE ALSO
cnv_ULONGtoA(), cnv_ULONGtoBITS()
EXAMPLE
...
ULONG value = 0;
UBYTE *string = "35007";
if ((cnv_AtoULONG(string, &value, QDEV_CNV_UXXXFBE_D)))
{
if (value == 35007)
{
...
}
}
BUGS
None known.
----------------------------------------------------------------------------
| |
| |