/// <summary>
/// 将数据写入txt
/// </summary>
/// <param name="str"></param>
public void LogWriteTxt(string str)
{
string path = Application.StartupPath +"\\"+"result_number.txt";
str = DateTime.Now.ToString("yyyy-MM-dd") +str;
if (!File.Exists(path))
{
FileStream fs = new FileStream(path, FileMode.Create, FileAccess.ReadWrite);
StreamWriter sw = new StreamWriter(fs);
sw.WriteLine(str);
sw.Flush();
sw.Close();
}
else
{
FileStream fs = new FileStream(path, FileMode.Append);
//文本写入
StreamWriter sw = new StreamWriter(fs);
sw.WriteLine(str);
sw.Flush();
sw.Close();
}
}