任意のファイルから生のバイト配列を読み取るにはどうすればよいですか...
Dim bytes() as Byte
..そして、そのバイト配列を新しいファイルに書き戻しますか?
間に何らかの処理を行うためのバイト配列として必要です。
私は現在使用しています:
読むには
Dim fInfo As New FileInfo(dataPath)
Dim numBytes As Long = fInfo.Length
Dim fs As 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()
書くには
Dim fs As System.IO.FileStream
fs = New System.IO.FileStream(outpath, System.IO.FileMode.Create)
fs.Write(bytes, 0, bytes.Length)
fs.Close()