C#文本文件读写代码
2009-12-06 21:33
204 查看
本文原址:http://zhengguomail.blog.163.com/blog/static/23910181200910443933884/
FileInfo version = new FileInfo(LogPath + "yb.txt");
FileStream Version_data = version.Open(FileMode.Open);
StreamReader Context = new StreamReader(Version_data, System.Text.Encoding.Default);
String contents = Context.ReadLine();
String contents2 = "";
StreamWriter log = new StreamWriter(LogPath + "jk.txt", true);
while (contents!=null && contents!="")
{
contents2 = contents2 + ";" + contents.Substring(contents.IndexOf("= /"") + 3, contents.IndexOf("/";") - contents.IndexOf("= /"") - 3);
contents = Context.ReadLine();
}
log.WriteLine(contents2);
log.Close();
StreamWriter log2 = new StreamWriter(LogPath + TimeUtil.getDate() + "SMTATTIMEError2.txt", true);
log2.WriteLine("time:" + System.DateTime.Now.ToLongTimeString());
log2.Close();
FileInfo version = new FileInfo(LogPath + "yb.txt");
FileStream Version_data = version.Open(FileMode.Open);
StreamReader Context = new StreamReader(Version_data, System.Text.Encoding.Default);
String contents = Context.ReadLine();
String contents2 = "";
StreamWriter log = new StreamWriter(LogPath + "jk.txt", true);
while (contents!=null && contents!="")
{
contents2 = contents2 + ";" + contents.Substring(contents.IndexOf("= /"") + 3, contents.IndexOf("/";") - contents.IndexOf("= /"") - 3);
contents = Context.ReadLine();
}
log.WriteLine(contents2);
log.Close();
StreamWriter log2 = new StreamWriter(LogPath + TimeUtil.getDate() + "SMTATTIMEError2.txt", true);
log2.WriteLine("time:" + System.DateTime.Now.ToLongTimeString());
log2.Close();
相关文章推荐
- C#.NET示例读写xml所有节点的代码实现方法和读取xml节点的数据总结
- C#.NET示例读写xml所有节点的代码实现方法和读取xml节点的数据总结
- C#读写Access数据库、表格datagridview窗体显示代码实例
- C# 读写文本文件乱码解决方案
- 读写ESRI Shapefile格式的C#代码
- C#读写文本文件的范例
- C# 读写XML(代码分享)
- C#中用SYSTEM.XML读写XML说明与代码
- c#基础知识---文本文件的读写
- C#读写日志文本文件
- c#读写文本文件
- C# 对文本文件的几种读写方法总结
- C#读写文本文件
- C# 对文本文件的读写
- C#代码关于文件文件夹的读写
- C# 对文本文件的几种读写方法总结
- C#对文本文件的读写
- C# Stream读写文本文件