Futurebasic/Language/Reference/append

From Wikibooks, open books for an open world
Jump to navigation Jump to search

Append[edit | edit source]

Statement[edit | edit source]

✔ Appearance ✔ Standard ✔ Console

Syntax[edit | edit source]

append [#]fileID

Description[edit | edit source]

This statement moves the file mark, in the currently-open file indicated by fileID, to the end-of-file position (without overwriting any of the existing data in the file). This causes subsequent file output statements such as print#, write# and write file# to append data to the end of the file.

Example[edit | edit source]

In the following, note that we open the output file using the "R" method. This is because opening with the "O" method causes the "end-of-file" mark to move to the beginning of the file, effectively erasing any existing data.

a$ = "TESTING..."
open "R", 1, fileName$,, wdRefNum% 'Open an existing file
append #1                          'Set file pointer to end
write #1, a$;25                    'Add data to end of file
close #1                           'Close file

Notes[edit | edit source]

No special notes.

See Also[edit | edit source]

files$; open; close; read#

Language Reference