Imports System
Imports System.IO
Public Class MainClass
Shared Sub Main()
Dim aFileStream As FileStream
Try
aFileStream = New FileStream("test.txt", FileMode.OpenOrCreate,FileAccess.Write)
Dim myBinaryWriter As New BinaryWriter(aFileStream)
myBinaryWriter.Write("Hello world")
myBinaryWriter.Write(1)
Catch e As Exception
Console.WriteLine(e.StackTrace)
Finally
If Not (aFileStream Is Nothing) Then aFileStream.Close()
End Try
End Sub
End Class
|