Append
Specifies text file to be opened for append mode
filename
A file mode used with Open to open a text file for writing.
This mode is used to add text to an existing file with Print #, or comma separated values with Write#.
Text files can't be simultaneously read and written in FreeBASIC, so if both functions are required on the same file, it must be opened twice.
filename must be a string expression resulting in a legal file name in the target OS, without wildcards. The file will be sought for in the present directory, unless the filename contains a path . If the file does not exist, it is created. The pointer is set after the last character of the file.
Encoding_type indicates the Unicode Encoding of the file, so characters are correctly read. If omitted, "ascii" encoding is defaulted. Only little endian character encodings are supported at the moment.
Syntax
Parameters
filename
file name to open for append
encoding_typeindicates encoding type for the file
lock_typelocking to be used while the file is open
filenumunused file number to associate with the open file
Description
A file mode used with Open to open a text file for writing.
This mode is used to add text to an existing file with Print #, or comma separated values with Write#.
Text files can't be simultaneously read and written in FreeBASIC, so if both functions are required on the same file, it must be opened twice.
filename must be a string expression resulting in a legal file name in the target OS, without wildcards. The file will be sought for in the present directory, unless the filename contains a path . If the file does not exist, it is created. The pointer is set after the last character of the file.
Encoding_type indicates the Unicode Encoding of the file, so characters are correctly read. If omitted, "ascii" encoding is defaulted. Only little endian character encodings are supported at the moment.
- "utf8"
- "utf16"
- "utf32"
- "ascii" (the default)
- Read - the file can be opened simultaneously by other processes, but not for reading
- Write - the file can be opened simultaneously by other processes, but not for writing
- Read Write - the file cannot be opened simultaneously by other processes (the default)
Example
Dim i As Integer
For i = 1 To 10
Open "test.txt" For Append As #1
Print #1, "extending test.txt"
Close #1
Next
For i = 1 To 10
Open "test.txt" For Append As #1
Print #1, "extending test.txt"
Close #1
Next
Differences from QB
- None
See also