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

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

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