[代码片断]创建或写文件
string filename = "c:\\a.txt";
string content = "hello world!~";
byte[] data = Encoding.Unicode.GetBytes( content );
using( FileStream fs = new FileStream( filename, FileMode.Append ) ) {
//开始写入
fs.Write( data, 0, data.Length );
//清空缓冲区、关闭流
fs.Flush();
fs.Close();
}
[代码片断]创建或写文件
------------------------------------------
除非特别声明,文章均为原创,版权与博客园共有,转载请保留出处
BUY ME COFFEE
![](https://images.cnblogs.com/cnblogs_com/kkun/212569/o_200616035329WechatIMG237.png)
![](https://images.cnblogs.com/cnblogs_com/kkun/212569/o_200616035334WechatIMG238.jpeg)