//写入txt{path:"\\person.txt"}
public void WriteTxt(string path, string content)
{
StreamWriter sw = new StreamWriter(Application.StartupPath + path);
sw.Write(content);
sw.Flush();
sw.Close();
}
//读取txt{path:"\\person.txt"}
public string ReadTxt(string path)
{
string str = String.Empty; ;
StreamReader sr = new StreamReader(Application.StartupPath + path);
str = sr.ReadToEnd();
sr.Close();
return str;
}
C#读写txt文件
最新推荐文章于 2022-10-29 14:48:03 发布