あるファイルから読み取り、途中でバッファーを使用して別のファイルに書き込むストリームライターがあります... fseek を使用してバイト位置をシークしますが、バイト位置からファイルの終わりまで書き込みます。バイト位置から x バイト量まで書き込みます。これを指定するにはどうすればよいですか?また、ファイルが大きくなる可能性があるため、数学はint64経由で行う必要があります...コードは次のとおりです。
Dim bytesRead As Integer
Dim buffer(4096) As Byte
Using inFile As New System.IO.FileStream("c:\some path\folder\file1.ext", IO.FileMode.Open, IO.FileAccess.Read)
inFile.Seek(s, SeekOrigin.Current)
Using outFile As New System.IO.FileStream("c:\some path\folder\file2.ext", IO.FileMode.Create, IO.FileAccess.Write)
Do
bytesRead = inFile.Read(buffer, 0, buffer.Length)
If bytesRead > 0 Then
outFile.Write(buffer, 0, bytesRead)
End If
Loop While bytesRead > 0
End Using
End Using