How can I read the original byte array from any file ...
Dim bytes() as Byte
.. and then write this byte array to a new file?
I need it as an array of bytes to do some processing between them.
I am currently using:
To read
Dim fInfo As New FileInfo(dataPath) Dim numBytes As Long = fInfo.Length Dim fsAs New FileStream(dataPath, FileMode.Open, FileAccess.Read) Dim br As New BinaryReader(fs) Dim bytes As Byte() = br.ReadBytes(CInt(numBytes)) br.Close() fs.Close()
To write
Dim fs As System.IO.FileStream fs = New System.IO.FileStream(outpath, System.IO.FileMode.Create) fs.Write(bytes, 0, bytes.Length) fs.Close()
Robin rodricks
source share