文件大小是30M.从17M左右开始读取3M字节,
将file_len 改成常量比如300万。就没有问题,使用成变量就是会报告:
Offset and length were out of bounds for the array or count is greater than the number of elements from index to the end of the source collection.
错误。
file_postion和file_len 是函数参数(int)
byte [] buffer = new byte[file_len];
FileStream fs = new FileStream(“txt”, FileMode.Open, FileAccess.ReadWrite);
BinaryReader Reader = new BinaryReader(fs);
Reader.Read(buffer, file_postion, filelen);
Reader.Close();
fs.Close();