fread_bytes — 从二进制文件读取字节。
fread_bytes( : : FileHandle, NumberOfBytes : ReadData, IsEOF)
算子 fread_bytes reads bytes from the input
file defined by FileHandle.
The input file must have been opened with open_file in
binary format.
The number of bytes to be read, greater than 0, is specified
as NumberOfBytes。
The bytes that are read are returned in ReadData.
IsEOF is set to 1 if end of file is reached while reading
the bytes from the input binary file. Otherwise, it is set to 0.
When the number of bytes to be read is larger than the number of
bytes in the input binary file, the operator fread_bytes returns
all bytes read till the end of the file in ReadData and parameter
IsEOF is set to 1.
If no byte can be read because the end of the file is reached,
ReadData is empty and IsEOF is set to 1.
FileHandle (输入控制) file → (handle)
File handle.
NumberOfBytes (输入控制) integer → (integer)
Number of bytes to be read.
ReadData (输出控制) integer-array → (integer)
Bytes read from the input binary file.
IsEOF (输出控制) integer → (integer)
Indicates if end of file is reached while reading the file.
* Read a binary file 5 bytes at a time till EOF is reached. open_file(Filename,'input_binary',FileHandle) repeat fread_bytes(FileHandle, 5, BytesRead, IsEOF) until (IsEOF) close_file (FileHandle)
If an input file is open in binary mode and no file read error occurs,the
operator fread_bytes 返回 2 ( H_MSG_TRUE )。否则,将抛出异常。
open_file,
close_file,
fwrite_bytes
基础