赞
踩
- static void Main(string[] args)
- {
- // 直接写入并且追加(自动创建)
- string text = "追加一个内容";
- string datetime = DateTime.Now.ToString("yyyyMMdd");
- File.AppendAllText("E:/测试.csv",text + " " + datetime +"\r\n", Encoding.UTF8);
- // 读取txt
- string value = string.Empty;
- FileStream fs = new FileStream("E:/测试.csv", FileMode.Open, FileAccess.Read);
- StreamReader sr = new StreamReader(fs, Encoding.UTF8);
- value = sr.ReadToEnd();
- Console.WriteLine(value );
- sr.Close();
- fs.Close();
- }
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。