Equinox Online Help - Language Reference - A to Z

Home

FileReadBinary

Applies to
SyntaxFileReadBinary HandleItem, Item [, LengthExpression
Action[Statement] Reads unformatted data into an Equinox data item
ScopeUsable anywhere
Notes

This statement reads data from the file specified by HandleItem into the item specified in the Item parameter. Whereas the FileRead statement reads formatted binary data, this statement reads unformatted data up to the length optionally specified in LengthExpression. If LengthExpression is omitted or supplied as less than zero, the size of the item is used as the amount to read, which for strings and memos means the current maximum length as obtained from the MaxLen function. Use the SetMaxLen function to change the maximum length of memos.

If LengthExpression is less than the size of the item, Equinox reads the specified amount, and does not alter the remainder. Note that this may lead to unexpected and environment-specific results if the item is not a string.

This statement works with files that have been opened in either sequential or random mode.

The HandleItem parameter must be of Equinox variable type Handle and is the handle of the file which was opened with the FileOpen statement.

The system workarea SysError is set to 4 if the end of file is detected and no items were read, 1 if an error occurs, otherwise zero.

CategoryFile IO
See Also FileClose, FileCloseAll, FileDelimiters, FileInput, FileInputLine, FileLock, FileMovePosition, FileOpen, FilePosition, FilePrint, FileRead, FileReadLine, FileReadBinary, FileReadFile, FileUnlock, FileWrite, FileWriteBinary, FileWriteFile
Example

This example reads a record and a date from an external data file.

string Record(256)
date StartDate

FileReadBinary hnd, Record, 256
FileReadBinary hnd, StartDate