FILEBIN_BLOCK_READ

FILEBIN_BLOCK_READ N,C,V%(P)

READS C BYTES FROM THE BINARY FILE NUMBER N AND STORES THE VALUES TO THE ARRAY V% FROM INDEX P

  • Type: Command
  • Parameters: 4
  • Group: Binary Files

ACTION

The command FILEBIN_BLOCK_READ N,C,V%(P) reads a block of C bytes from the binary file number N and stores the read values to the array V% from index P.

The array V% must be of the type integer.

The current position in the binary file is increased by C.

SYNTAX: FILEBIN_BLOCK_READ N,C,V%(P)

  • N = binary file number (integer or real). Must be greater than 0 and less than or equal to the maximum of allowed binary file number.
  • V% = name of variable array, of type integer.
  • C = bytes number, of type integer or real.
  • P = array index, of type integer or real.

USE

  • The command FILEBIN_BLOCK_READ is used to read a block of bytes from a binary file.

ERROR

  • If number N is not a correct expression.
  • If number N exceeds the maximum of allowed binary file number.
  • If number N is not used for an open binary file.
  • If C is not a correct expression.
  • If C is less than 1.
  • If P is not a correct expression.
  • If P is less than 1.
  • If the size of V%() is not greater than or equal to P+C-1.
  • If V% is not a declared variable.
  • If V% is not a variable of type array integer.

EXAMPLE

rem open a binary file for reading

filebin_open_read 1,"file.abc"

rem set the position to 5

filebin_position 1,5

rem read 10 bytes

filebin_block_read 1,10,v%(7)

rem print the second read byte

print v%(8)

rem close the binary file

filebin_close 1

SEE ALSO

FILEBIN_BLOCK_WRITE

FILEBIN_CLOSE

FILEBIN_HEXA_READ

FILEBIN_HEXA_READ$()

FILEBIN_HEXA_WRITE

FILEBIN_OPEN_READ

FILEBIN_OPEN_WRITE

FILEBIN_POS()

FILEBIN_POSITION

FILEBIN_READ

FILEBIN_READ()

FILEBIN_SIZE()

FILEBIN_WRITE