TextOutputStream.Open

From Xojo Documentation

Shared Method

TextOutputStream.Open(f as FolderItem) As TextOutputStream

New in 2019r2

Opens the passed file so that text can be added to the end of the file.

Notes

If no file exists at the specified location, one is created. If the file cannot be created or opened for adding, an IOException is raised. Add text by calling Write or WriteLine.

Example

This example adds the text in TextField1 to the text file that was opened by GetOpenFolderItem:

Var f As FolderItem = FolderItem.ShowOpenFileDialog(FileTypes1.Text)
If f <> Nil Then
Try
Var t As TextOutputStream = TextOutputStream.Open(f)
t.Write(TextField1.Value)
Catch e As IOException
// handle error
End Try
End If