Read and Write to a Newly Created Data File
Imports System
Imports System.IO
Class MyStream
Public Shared Sub Main()
Using fs As New FileStream("Test.data", FileMode.CreateNew)
Using w As New BinaryWriter(fs)
For i As Integer = 0 To 10
w.Write(i)
Next
End Using
End Using
Using fs As New FileStream("Test.data", FileMode.Open, FileAccess.Read)
Using r As New BinaryReader(fs)
For i As Integer = 0 To 10
Console.WriteLine(r.ReadInt32())
Next
End Using
End Using
End Sub
End Class
Related examples in the same category