C#将代码中的信息保存为txt或ini文件
这是我在使用坚石诚信的ET99产品时将信息写为ini文件的一段代码:
FileStream fs = new FileStream("log.ini", FileMode.Append, FileAccess.Write);
StreamWriter sw = new StreamWriter(fs);
DateTime time = DateTime.Now;
sw.WriteLine(time);
sw.WriteLine("PID种子:" + strPIDseed);
sw.WriteLine("SO PIN种子:" + strSOPINseed);
sw.WriteLine("PID:" + strPID);
sw.WriteLine("SO PIN:" + strSOPIN);
sw.WriteLine("User PIN:" + strUserPIN); sw.WriteLine("*********************************");
sw.Close();
fs.Close();