Reading and writing binary files
' --- Read a binary file and write the content to another file
' imports system.io
Dim s_infilename As String = "infile.dat"
Dim s_outfilename As String = "outfile.dat"
Dim databuffer(1) As Byte
Dim f_inputfile As FileStream
Dim f_outputfile As FileStream
f_inputfile = New FileStream(s_infilename, FileMode.Open)
f_outputfile = New FileStream(s_outfilename, FileMode.Create)
ReDim databuffer(f_inputfile.Length)
f_inputfile.Read(databuffer, 0, databuffer.Length)
f_outputfile.Write(databuffer, 0, databuffer.Length)
f_inputfile.Close()
f_outputfile.Close()
Visitor Comments