简单文件读取与写入

//简单易记

static void Main(string[] args)

 

      {

           //StreamWriter w = File.CreateText ("D:\\dome.txt");

           //w.Write("不要忘记!");
           //w.Write("不要忘记生日!");
           //w.Write("不要忘记这些数字:");
           //w.Write("0 1 2 3 7 8 9");
           //w.Close();

//一定要记得关闭释放哦!
           //StreamReader w = File.OpenText("D:\\dome.txt");
           //Console.WriteLine(w.ReadToEnd());
           //w.Close();
           //用streamreader读出汉字
           //StreamReader sr = new StreamReader("D:\\net.txt", Encoding.GetEncoding("GBK"));
           //Console.Write(sr.ReadToEnd());
           //sr.Close();


}

你可能感兴趣的:(Stream,StreamReader,StreamWriter)