TextOutputStream.Append

From Xojo Documentation

Revision as of 19:09, 3 September 2020 by THill (talk | contribs) (Text replacement - "{{Deprecated|" to "{{DeprecatedItem|")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Shared Method

TextOutputStream.Append(f as FolderItem) As TextOutputStream

New in 2009r5

Supported for all project types and targets.

Opens the passed file so that text can be appended to existing text.

Notes

If no file exists at the specified location, one is created. If the file cannot be created or opened for appending, an IOException is raised. The append is done by calling Write or WriteLine. The Append shared method replaces the deprecated FolderItem.AppendToTextFile.

Example

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

Dim f As FolderItem = GetOpenFolderItem(FileTypes1.Text)
If f <> Nil Then
Try
Dim t As TextOutputStream = TextOutputStream.Append(f)
t.Write(TextField1.Text)
Catch e As IOException
// handle error
End Try
End If