文件流不往下走了
seek定位无效,想不通,请问各位是什么原因?using (FileStream s = new FileStream(fn, FileMode.Open, FileAccess.Read))
{
byte[] data = new byte[2140];
using (BinaryReader br = new BinaryReader(s))
{
for (int i = 0; i < input.Count; i++)
{
pos = 2140 * long.Parse(input[i]);
br.BaseStream.Seek(pos, SeekOrigin.Begin);
while (read > 0)
{
read = br.Read(data, 0, 2140);
sb.Append(Encoding.GetEncoding("utf-8").GetString(data));
read-=2140;
}
}
}
} --------------------编程问答-------------------- while (read > 0) 这一行执行之前 read 都没有值。
补充:.NET技术 , ASP.NET