FILE_WRITE

FILE_WRITE N,S

WRITES THE DATA S TO THE TEXT FILE NUMBER N

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

ACTION

The command FILE_WRITE N,S writes the data S to the text file number N, without going to next line, the data being in the variable S of type integer, real or string, or in the string expression S.

Example :

file_write 1,Ab3(6) (variable belonging to a real array)

file_write 1,A$+B$ (string expression)

file_write 1,"Hello !"

SYNTAX: FILE_WRITE N,S

  • N = file number (integer or real). Must be greater than 0 and less than or equal to the maximum of allowed text file number.
  • S = name of variable, or string expression.

USE

  • The command FILE_WRITE is used to write a data to 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 S is not a correct expression.
  • If S is not a declared variable.

EXAMPLE

rem open a file for writing

file_open_write 1,"my_file.txt"

rem write a data

file_write 1,"Hello !"

rem close it

file_close 1

SEE ALSO

FILE_CLOSE

FILE_EOF()

FILE_OPEN_APPEND

FILE_OPEN_READ

FILE_OPEN_WRITE

FILE_READ

FILE_READBUF

FILE_READLN

FILE_READLN$()

FILE_WRITEBUF

FILE_WRITELN