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")
For lngLoop = 0 To intByte - 1
myFileStream.WriteByte(bteWrite(lngLoop))
Next
myFileStream.Close()
Catch ex As IOException
Console.WriteLine(ex.Message)
End Try
End Sub
End Class
|