[C#] 纯文本查看 复制代码 using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.IO;
namespace 读取文件和写入文件
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
StreamWriter sfile = new StreamWriter("j://sufei.txt");//写入到sufei.txt文件中
sfile.Write("sufeisufei");
sfile.Close();
StreamReader ss = new StreamReader("j://sufei.txt");//读取文件sufei.txt中的内容
this.richTextBox1.Text = ss.ReadLine();
ss.Close();
}
}
}
|