当前位置:编程学习 > C#/ASP.NET >>

文件流不往下走了

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
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,