private void button1_Click(object sender, EventArgs e)
{
FileStream rfs,wfs;
StreamWriter sw;
StreamReader sr;
//FileStream stream = new FileStream(@"E:mxh20141013addr111.csv", FileMode.Open);
//StreamReader reader = new StreamReader(stream, Encoding.GetEncoding("gb2312"));
rfs = new FileStream(@"E:mxh20141013addr111.csv", FileMode.Open);
sr = new StreamReader(rfs, Encoding.GetEncoding("gb2312"));
wfs = new FileStream(@"E:mxh20141013addr222.txt", FileMode.Create, FileAccess.Write);
sw = new StreamWriter(wfs,Encoding.GetEncoding("gb2312"));
string sLine = "";
string[] myList;
while (sLine != null)
{
sLine =sr.ReadLine();
if (sLine != null)
{
myList = sLine.Split(',');
sw.WriteLine("企业名称: "+myList[0]);
sw.WriteLine("发件地址: "+myList[1]);
sw.WriteLine("收件人: " + myList[2]);
sw.WriteLine();
}
}
sw.Close();
wfs.Close();
sr.Close();
rfs.Close();
Close();
}