filestream.read(buffer,offset,count)

offset是buffer的偏移量 所以,filestream.read(buffer,1,count)会报下面的错

System.ArgumentException: 偏移量和长度超出数组的界限,或者计数大于从索引到源集合结尾处的元素数量

 

正确的做法是:

fs.Seek(iStart, SeekOrigin.Begin);

b = new byte[count];

fs.Read(b, 0, count);

 

相关文章:

  • 2021-12-30
  • 2021-12-10
  • 2022-12-23
  • 2022-12-23
  • 2021-09-01
  • 2022-12-23
  • 2021-08-10
  • 2021-10-21
猜你喜欢
  • 2021-06-12
  • 2022-12-23
  • 2022-12-23
  • 2021-08-31
  • 2021-12-01
  • 2021-12-01
相关资源
相似解决方案