The [file->openAppend] method can be called on a [file] object to open a file for appending and reading the file. If a path is already stored in the [file] object, it can be called with no parameters. It can also be called with a string specifying the path to a file. If it is called with a path to a file, that new path becomes the path for the [file] object, overriding any previous path.
If [file->openAppend] is called with a file path, it can also take an optional boolean parameter that specifies whether or not to create the file if it doesn't already exist. The default is true which means the file will be created if it does not already exist.
local(f) = file(...)
#f->openAppend
local(f) = file
#f->openAppend('/path/to/file.txt')
local(f) = file
#f->openAppend('/path/to/file.txt', false)
The code below will add the line "Great Scott!" to the end of the file "test.txt"
Code
local(my_file) = file
handle => {#my_file->close}
#my_file->openAppend('test.txt')
#my_file->writeString('\n"Great Scott!"')
Please note that periodically LassoSoft will go through the notes and may incorporate information from them into the documentation. Any submission here gives LassoSoft a non-exclusive license and will be made available in various formats to the Lasso community.
©LassoSoft Inc 2015 | Web Development by Treefrog Inc | Privacy | Legal terms and Shipping | Contact LassoSoft
Recent Comments