AOpen Statement

Opens file in the appending mode.

Syntax

AOpen fileName As #fileNumber
.
.
Close #fileNumber

Parameters

fileName
Specify a string containing the path and file name. If path is omitted, the file in the current directory is specified. See ChDisk for the details.
fileNumber
Specify an integer value from 30 to 63 or an expression.

Description
Opens the specified file and identifies it by the specified file number. This statement is used for appending data to the specified file. If the specified file is not found, create a new file.

The specified fileNumber identifies the file while it is open and cannot be used to refer to a different file until the current file is closed. fileNumber is used by other file operations such as Print#, Write, Flush, and Close.

Close closes the file and releases the file number.

It is recommended that you use the FreeFile function to obtain the file number so that more than one task are not using the same number.

Notes


  • A network path is available.
  • File write buffering File writing is buffered.
  • The buffered data can be written with Flush statement. Also, when closing a file with Close statement, the buffered data can be written.

See Also
Close, Print #, BOpen, ROpen, UOpen, WOpen, FreeFile, Flush

AOpen Statement Example

Integer fileNum, i
fileNum = FreeFile
WOpen "TEST.DAT " As #fileNum
For i = 0 To 100
   Print #fileNum, i
Next I
Close #fileNum
....
....
....
FileNum = FreeFile
AOpen "TEST.DAT" As #FileNum
For i = 101 to 200
   Print #FileNum, i
Next i
Close #FileNum