<< Previous | Next >>

hexstrtobyte

int hexstrtobyte (char far *p);

Description

Converts two hex characters (0-9A-Fa-f) to a byte.

Return Value

The byte (0-255) represented by the two hex characters or -1 on error (invalid character, string less than 2 bytes).

Examples

hexstrtobyte("FF") returns 255
hexstrtobyte("0") returns -1 (error because < 2 characters)
hexstrtobyte("ABCDEF") returns 0xAB (ignores additional chars)


Dynamic C Functions << Previous | Next >> rabbit.com