regexps.com
The functions in this chapter convert between numbers and ASCII strings.
NOTE: Floating point conversions are not included with this release of the Hackerlab C Library. They will be included in a future release.
The functions in this chapter convert between integer types and strings.
void cvt_ulong_to_decimal (t_uchar * nbuf, unsigned long n);
Convert n
to a 0-terminated decimal number.
void cvt_long_to_decimal (t_uchar * nbuf, long n);
Convert n
to a 0-terminated decimal number.
void cvt_ulong_to_octal (t_uchar * nbuf, unsigned long n);
Convert n
to a 0-terminated octal number.
void cvt_long_to_octal (t_uchar * nbuf, long n);
Convert n
to a 0-terminated octal number.
void cvt_ulong_to_HEX (t_uchar * nbuf, unsigned long n);
Convert n
to a 0-terminated hexadecimal number using upper-case
hex digits
A..F
.
void cvt_long_to_HEX (t_uchar * nbuf, long n);
Convert n
to a 0-terminated hexadecimal number using upper-case
hex digits
A..F
.
void cvt_ulong_to_hex (t_uchar * nbuf, unsigned long n);
Convert n
to a 0-terminated hexadecimal number using lower-case
hex digits
a..f
.
void cvt_long_to_hex (t_uchar * nbuf, long n);
Convert n
to a 0-terminated hexadecimal number using lower-case
hex digits
a..f
.
int cvt_decimal_to_ulong (int * errn, unsigned long * answerp, const t_uchar * text, size_t len);
Convert the decimal number text
to an unsigned long integer.
Return 0
upon success, -1
on error.
On error, *errn
may be:
ERANGE the decimal number will not fit in an `unsigned long'. EINVAL `text' is not a valid decimal number.
int cvt_decimal_to_uint (int * errn, unsigned int * answerp, const t_uchar * text, size_t len);
Convert the decimal number text
to an unsigned integer.
Return 0
upon success, -1
on error.
On error, *errn
may be:
ERANGE the decimal number will not fit in an `unsigned int'. EINVAL `text' is not a valid decimal number.
int cvt_decimal_to_long (int * errn, long * answerp, const t_uchar * text, size_t len);
Convert the decimal number text
to a long integer.
Return 0
upon success, -1
on error.
On error, *errn
may be:
ERANGE the decimal number will not fit in a `long'. EINVAL `text' is not a valid decimal number.
int cvt_decimal_to_int (int * errn, int * answerp, const t_uchar * text, size_t len);
Convert the decimal number text
to an integer.
Return 0
upon success, -1
on error.
On error, *errn
may be:
ERANGE the decimal number will not fit in an `int'. EINVAL `text' is not a valid decimal number.
int cvt_hex_to_ulong (int * errn, unsigned long * answerp, const t_uchar * text, size_t len);
Convert the hexadecimal number text
to an unsigned long integer.
Return 0
upon success, -1
on error.
On error, *errn
may be:
ERANGE the hexadecimal number will not fit in an `unsigned long'. EINVAL `text' is not a valid hexadecimal number.
int cvt_hex_to_uint (int * errn, unsigned int * answerp, const t_uchar * text, size_t len);
Convert the hexadecimal number text
to an unsigned integer.
Return 0
upon success, -1
on error.
On error, *errn
may be:
ERANGE the hexadecimal number will not fit in an `unsigned int'. EINVAL `text' is not a valid hexadecimal number.
int cvt_hex_to_long (int * errn, long * answerp, const t_uchar * text, size_t len);
Convert the hexadecimal number text
to a long integer.
Return 0
upon success, -1
on error.
On error, *errn
may be:
ERANGE the hexadecimal number will not fit in a `long'. EINVAL `text' is not a valid hexadecimal number.
int cvt_hex_to_int (int * errn, int * answerp, const t_uchar * text, size_t len);
Convert the hexadecimal number text
to an integer.
Return 0
upon success, -1
on error.
On error, *errn
may be:
ERANGE the hexadecimal number will not fit in an `int'. EINVAL `text' is not a valid hexadecimal number.
int cvt_octal_to_ulong (int * errn, unsigned long * answerp, const t_uchar * text, size_t len);
Convert the octal number text
to an unsigned long integer.
Return 0
upon success, -1
on error.
On error, *errn
may be:
ERANGE the octal number will not fit in an `unsigned long'. EINVAL `text' is not a valid octal number.
int cvt_octal_to_uint (int * errn, unsigned int * answerp, const t_uchar * text, size_t len);
Convert the octal number text
to an unsigned integer.
Return 0
upon success, -1
on error.
On error, *errn
may be:
ERANGE the octal number will not fit in an `unsigned int'. EINVAL `text' is not a valid octal number.
int cvt_octal_to_long (int * errn, long * answerp, const t_uchar * text, size_t len);
Convert the octal number text
to a long integer.
Return 0
upon success, -1
on error.
On error, *errn
may be:
ERANGE the octal number will not fit in a `long'. EINVAL `text' is not a valid octal number.
int cvt_octal_to_int (int * errn, int * answerp, const t_uchar * text, size_t len);
Convert the octal number text
to an integer.
Return 0
upon success, -1
on error.
On error, *errn
may be:
ERANGE the octal number will not fit in an `int'. EINVAL `text' is not a valid octal number.
regexps.com