TextOutputStream.Constructor(handle as Integer, type as Integer)

From Xojo Documentation

Constructor
TextOutputStream.Constructor(handle as Integer, type as Integer)

Creates a TextOutputStream instance.

Notes

Type is one of the HandleType class constants and Handle is the appropriate handle type specified by the Type parameter.

The following class constants can be used to specify the optional Type parameter in the constructor.

Class Constant Description
HandleTypeWin32Handle A Windows 32 OS handle
HandleTypeFilePointer A file pointer.
HandleTypeFileNumber A file descriptor.
HandleTypeMacFileRefNum A file reference number
HandleTypeMacFileSpecPointer An FSSpec.

For instance, you can use a Declare to open a file with whatever permissions that you wish, and then pass the Handle to a stream object’s constructor.

Sample Code

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

Dim f As FolderItem
Dim t As TextOutputStream
f = GetOpenFolderItem(FileTypes1.Text)
If f <> Nil then
t = TextOutputStream.Append(f)
t.Write(TextField1.Text)
t.Close
End If