_05StreamReador和StreamWrite

 1 using System;
 2 using System.Collections.Generic;
 3 using System.IO;
 4 using System.Linq;
 5 using System.Text;
 6 using System.Threading.Tasks;
 7 
 8 namespace _05StreamReador和StreamWrite
 9 {
10     class Program
11     {
12         static void Main(string[] args)
13         {
14             //using (StreamReader sr = new StreamReader(@"C:\Users\Administrator\Desktop\1.txt", Encoding.Default))
15             //{
16             //    //string i = sr.ReadLine();//只读取了一行
17             //    //Console.WriteLine(i);
18 
19             //    //string s = sr.ReadToEnd();//从头读到尾巴
20             //    //Console.WriteLine(s);
21 
22             //    while (!sr.EndOfStream)//判断是否读取完
23             //    {
24             //        string st = sr.ReadLine();
25             //        Console.WriteLine(st);
26             //    }
27             //}
28 
29             using (StreamWriter sw = new StreamWriter(@"C:\Users\Administrator\Desktop\1.txt", true, Encoding.UTF8))
30             {
31                 sw.WriteLine("嘎哈人口");
32             }
33         }
34     }
35 }

posted @ 2018-09-19 18:54  白纸菇凉  阅读(109)  评论(0编辑  收藏  举报