如何使用C# FileStream类?
FileStream类提供了用于文件操作(例如读取和写入)的流。
创建一个像这样的对象
FileStream fstream = new FileStream("d:ew.txt", FileMode.OpenOrCreate);登录后复制
以下示例展示了如何在 C# 中使用 FileStream 类 -
using System; using System.IO; public class Demo { public static void Main(string[] args) { FileStream fstream = new FileStream("d:ew.txt", FileMode.OpenOrCreate); // write into the file fstream.WriteByte(90); // close the file fstream.Close(); } }登录后复制