5 readbin () – Teledyne LeCroy SAS_SATA Protocol Suite Verification Script Engine Reference Manual User Manual

Page 69

Advertising
background image


69

18.5 ReadBin ()

This function reads content from a binary file.

Case 1: Open and Read the content from a binary file
The file should be opened ONLY in _FC_RW_APPEND mode (because _FC_RW_CREATE
mode erases all the content of the file while it is opening). Because APPEND mode drags the
file pointer to the end of the file, use the SeekToBegin() function ito start reading from the
beginning of the file.

Case 2: Reading the just-written content from an already opened binary file.
The file might have already been opened in CREATE or APPEND mode (to write the content),
so to read the written content, use the SeekToBegin() function, as explained in case 1 above,
and start reading sequentially.

Before reading a binary file, you should know the content inside the file in terms of its order of
data types. The ReadBin function should be called in the exact sequence of the WriteBin
function. (Refer to the example of WriteBin() to compare the sequence of data read/write
from/to file.)


Format :

ReadBin( bin_file_handle )


Parameters

bin_file_handle

File handle for the binary file (only opened using _FO_BINARY)
from which the contents are to be read.
Note: Opening the file in _FC_RW_CREATE mode erases
content (if any) of the file.

Return Value
Content of the opened binary file, which can be any data type
(integer, string, raw data, and so on).

























Advertising