Imports System.IO
Imports System.Text
Public Class Tester
Public Shared Sub Main
Dim myFileStream As FileStream
Dim bteWrite() As Byte
Dim intByte As Integer
Dim lngLoop As Long
Try
intByte = Encoding.ASCII.GetBytes("asdf").Length
ReDim bteWrite(intByte)
bteWrite = Encoding.ASCII.GetBytes("asdf")
myFileStream = File.OpenWrite("test.txt")
Dim myOrigin As SeekOrigin
Dim lngPosition As Long
lngPosition = 123
myOrigin = SeekOrigin.Begin
' myOrigin = SeekOrigin.Current
' myOrigin = SeekOrigin.End
myFileStream.Seek(lngPosition, myOrigin)
For lngLoop = 0 To intByte - 1
myFileStream.Seek(1, SeekOrigin.Current)
myFileStream.WriteByte(bteWrite(lngLoop))
Next
myFileStream.Close()
Catch ex As IOException
Console.WriteLine(ex.Message)
End Try
End Sub
End Class