你的位置:首页 > ASP.net教程

[ASP.net教程]C# 文件流基本操作步骤


private void button1_Click(object sender, EventArgs e)    {      FileStream fs = new FileStream("123.txt", FileMode.Append);      StreamWriter ws = new StreamWriter(fs);      ws.WriteLine(this.txtbox.Text = DateTime.Now.ToString()+" " + "写入成功");      ws.Close();      fs.Close();    }    private void button2_Click(object sender, EventArgs e)    {      FileStream fs = new FileStream("123.txt", FileMode.Open);            StreamReader ws = new StreamReader(fs);      this.txtbox.Text = ws.ReadToEnd();      ws.Close();      fs.Close();    }