C#文件处理

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO; namespace 文件转换
{
class Program
{ static void Main(string[] args)
{
FileStream fs = new FileStream("d://test.TXT",FileMode.Open);// open file fs
StreamReader my_streamReader = new StreamReader(fs); //read
my_streamReader.BaseStream .Seek (0,SeekOrigin.Begin);
string arry = "";
string strLine = my_streamReader.ReadLine();
do
{
string[] split = strLine.Split('=');
string a = split[0];
if (a.ToLower() == "ip")
{
arry += strLine + "\n";
}
strLine = my_streamReader.ReadLine();
}
while (strLine != null && strLine != "");
my_streamReader.Close();
my_streamReader.Dispose();
fs.Close();
fs.Dispose();
Console.Write(arry);
Console.ReadLine(); }
}
}
http://zhidao.baidu.com/link?url=aht_Bi_d7o0jhPWyWV-rClQJbv71Mx8dPRTe0p4nJan1lZs-hTH1QBV6cjffCtRN2Z12uMpGmQrxIFtDqN2G4q
上一篇:12SpringMvc_在业务控制方法中写入普通变量收集参数


下一篇:使用 github 做代码管理,知道这些就够了