Mega Code Archive

 
Categories / VB.Net Tutorial / Stream File
 

Use FileStream to write byte array

Imports System.IO Public Class Tester     Public Shared Sub Main         Dim fs As System.IO.FileStream         Dim buffer As String         Dim i As Integer         Dim myarray(100) As Byte         fs = New System.IO.FileStream("test.txt", IO.FileMode.OpenOrCreate)         For i = 0 To 99             myarray(i) = i         Next         fs.Seek(0, System.IO.SeekOrigin.End)         fs.Write(myarray, 0, 100)         fs.Close()     End Sub End Class