%rdhex() Function

The %rdhex() function reads the number of bytes designated by (size * 2) into var from the file specified in file.descriptor, converting each byte into two ASCII hexadecimal characters.

Syntax

n = %rdhex(file.descriptor, var, size)

Parameter(s)

file.descriptor

file.descriptor is returned by a previous call to %open(), %creat(), or %dup().

var

Contains the 2-byte hexadecimal characters returned. A string at least twice the size of the number of bytes read must have been assigned to var before the call by either an explicit assignment (for example, buffer=space(1000)) or by the charreserve statement, otherwise data is truncated.

size

The number of (bytes * 2) to read.

Description

The function returns the number of bytes actually read or -1 if an error occurred. If less than twice the size of size bytes are returned, the content of the trailing string is undefined, as is normal in C. This function is the opposite of %whex().

See Also

%creat() Function, %dup() Function, %open() Function, %read() Function, %whex() Function, FlashBASIC C Functions Overview, cfunction Statement