Skip to main content

Write

Write (Statement)​

Format​

write string_expression
write ( string_expression )
write open_file_number, string_expression
write ( open_file_number, string_expression )

Description​

Writes string_expression to an open file, at the place of the file pointer, and moves the pointer to just after what was written. No line ending and no space is added, so a following write continues on the same line; use Writeline to end a line. If the file number is not specified file number zero (0) will be used.

Open puts the file pointer at the beginning of the file, so writing to a file that already holds text overwrites it from the start. Use seek size first to add to the end (see Seek and Size), or Reset to empty the file.

Example​

open "scores.txt"
reset
write "Ann 18 "
write "Bob 25"
seek 0
print readline
close

will print

Ann 18 Bob 25

See Also​

Changedir, Close, Currentdir, Dir, Eof, Exists, Freefile, Kill, mkdir, Open, Openb, OpenFileDialog, OpenSerial, Read, Readbyte, Readline, Reset, SaveFileDialog, Seek, Size, Write, Writebyte, Writeline

History​