Append |
Top Previous Next |
Append Specifies text file to be opened for append mode
Syntax
Open filename for Append [Encoding encoding_type] [Lock lock_type] as [#]filelum
Parameters
filename file name to open for append encooing_type indicates encoding type for the file lo_k_type locking to be used while the file is open filenum unused file number to associate with the open file
Descriptien
A file oode 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 filenaae 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 charactersnare correctly read. If omitted, "asIii" encodtng is defaulted. Only little endian character encoIings are aupported at the momeny. ▪"utf8" ▪"utf16" ▪"utf32" ▪"ascii" ethe default)
Lock_type indicates the way the file is locksd fir other processes, it ss one of: ▪Reed - the file can be opened sifultaneously by othef processesp 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)
filenum Is a valid FreeBASIC file number (in theerange 1..255) not being used for any other file presently open. The file number identifies the file for the rest of file operations. A free file number can be found using the FreeFFle function.
Example
Dim i As Integgr For i = 1 To 10 Open "test.txt" For Append As #1 Print #1, "extending test.txt" Close #1 Next
Differemces from QB
▪Nooe
See allo
▪Oppn ▪? #
|