basic.%rdhex
Reads a Unix file and translates to hexadecimal.
Syntax
n=%rdhex(file.descriptor, variable, size)
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()'.
See Also
User Comments
What do you think?
Share your experience or ask a question by using the form below.
Login to leave your comments.
