Xojo.IO.BinaryStream.Create

From Xojo Documentation

Shared Method

Creates a new BinaryStream, bound to the passed File. Raises a RuntimeException if File is Nil, does not exist, is not accessible or another error occurs.

Sample Code

Using Xojo.IO
Using Xojo.Core

Dim f As FolderItem = SpecialFolder.Documents.Child("MyFile.data")
Dim bStream As BinaryStream
bStream = BinaryStream.Create(f)

Dim data As MemoryBlock
Dim t As Text = "Text for the binary file."
data = TextEncoding.UTF8.ConvertTextToData(t)
bStream.Write(data)
bStream.Close