IO边读边写

  using (FileStream fs = new FileStream(@"C:\Users\Desktop\lijia1.txt",FileMode.Open))
           {
               using (FileStream fs1 = new FileStream(@"C:\Users\Desktop\lijia1Copy.txt", FileMode.Create))
               {
                   byte[] arr = new byte[200];
                   int count;
                   while (fs.Position<fs.Length) //fs.Position 获得当前读取的位置
                   {
                       count = fs.Read(arr, 0, arr.Length);
                       fs1.Write(arr, 0, count);
                   }
               }
 
           }
posted @ 2016-12-22 15:47  流星泪  阅读(357)  评论(0编辑  收藏  举报