%RDHEX

%RDHEX


%PUTENV Index Level %READ (D3/Unix)
Syntax n = %RDHEX( file.descriptor, variable, size )
Category BASIC
Type C Function
Description reads the number of bytes designated by "size" into "variable" from the file specified by "file.descriptor" returned by a previous call to "%open()", "%creat()" or "dup()" converting each byte into two ASCII hexadecimal characters.

A string of a size at least equal to 2 * "size" must have been assigned to "variable" before the call by either an explicit assignment (e.g. buffer=space(1000)) or by the "char" reserve statement, otherwise data will be truncated.

The function returns the number of bytes actually read or "-1" if an error occurred. If less than 2 * "size" bytes are returned, the content of the string beyond is undefined, as is usual in C. This function is the opposite of "%whex()".
Options
See Also CFUNCTION c function %CREAT %DUP %READ (D3/Unix) %WHEX %OPEN
Example
Warnings
Compatibility D3/Unix
%PUTENV Index Level %READ (D3/Unix)