Imports System.IO
Public Class RWByte
Public fs As filestream
Public Buffer(10) As Byte
Public Sub Main()
Dim fn As String = "test.xxx"
Dim start, count As Integer
start = 0
Dim buff() As Byte = {55, 22, 255, 126, 18} ' Data to write
count = buff.Length ' the number of bytes to write
fs = New FileStream(fn, FileMode.Create) ' Open file
fs.Write(buff, 0, 5) ' write 5 bytes of array starting at index zero
fs.Close() ' close Write stream
fs = New FileStream(fn, FileMode.Open) ' open stream for read
fs.Read(Buffer, start, count) ' read file into different buffer
fs.Close() ' close read stream
End Sub
End Class