标签:style blog color os 文件 io div line
创建文件并写入内容
StreamWriter sw = new StreamWriter(url, “false 覆盖,true 追加”, Encoding.UTF8); sw.Write(“内容”); sw.Close();
读取文件内容
FileInfo info = new FileInfo("路径"); FileStream fs = new FileStream(pash, FileMode.OpenOrCreate, FileAccess.Read); byte[] b = new byte[info.Length]; fs.Read(b, 0,b.Length); UTF8Encoding utf = new UTF8Encoding(); string st = utf.GetString(b); fs.Close(); //st 文本内容
FileStream 个方法中也有创建、写入、读取等方法。
标签:style blog color os 文件 io div line
原文地址:http://www.cnblogs.com/bit-by-bit/p/3878532.html