StreamReader and StreadWriter

                FileInfo file = new FileInfo(@"E:\jj.txt");

                StreamReader sr = new StreamReader(@"E:\\dd.txt");

                FileStream fs = new FileStream(@"E:\jj.txt", FileMode.Create);



                StreamWriter sw = new StreamWriter(fs, System.Text.Encoding.GetEncoding("utf-8"));

                string content = sr.ReadLine();



                while (!string.IsNullOrEmpty(content))

                {

                    content = content.Substring(5);

                    Console.WriteLine(content);

                    sw.WriteLine(content.ToCharArray());

                    content = sr.ReadLine();

                }
         sw.Close();
              fs.Close();

 

 

 

 

你可能感兴趣的:(Stream)