FILE_READBUF

FILE_READBUF N,V,C

READS C CHARACTERS OF THE TEXT FILE NUMBER N AND STORES THEM INTO VARIABLE V

  • Type: Command
  • Parameters: 3
  • Group: Text Files

ACTION

The command FILE_READBUF N,V,C reads C characters of the text file number N and stores them into variable V.

The variable V is of the type string.

SYNTAX: FILE_READBUF N,V,C

  • N = file number (integer or real). Must be greater than 0 and less than or equal to the maximum of allowed text file number.
  • V = variable name of type string.
  • C = number of characters to be read from the file.

USE

  • The command FILE_READBUF is used to read a certain number of characters of a text file.

ERROR

  • If number N is not a correct expression.
  • If number N exceeds the maximum of allowed text file number.
  • If number N is not used for an open text file.
  • If V is not a correct variable name.
  • If V is not a declared variable.
  • If V is not a string variable.
  • If C is not a correct expression.
  • If C is less than or equal to 0.

EXAMPLE

rem open a file for reading

file_open_read 1,"my_file.txt"

rem read 8 character

file_readbuf 1,a$,8

rem close it

file_close 1

SEE ALSO

FILE_CLOSE

FILE_EOF()

FILE_OPEN_APPEND

FILE_OPEN_READ

FILE_OPEN_WRITE

FILE_READ

FILE_READLN

FILE_READLN$()

FILE_WRITE

FILE_WRITEBUF

FILE_WRITELN