为啥StreamWriter写入txt失败
这是我编的一个小程序,是要读取data.txt中开头是0的行,然后写进out.txt中,可是程序运行后,out.txt中是空的,求教是哪里错了呢?谢谢!using System;
using System.Collections.Generic;
using System.Text;
using
namespace ConsoleApplication4
{
class Program
{
static void Main(string[] args)
{
StreamReader data = new StreamReader("E:\\data.txt");
string Line1 = "";
StreamWriter radardata = new StreamWriter("E:\\out.txt", false);
radardata.Write("译码:");
while (Line1 != null)
{
Line1 = data.ReadLine();
char[] chars = Line1.ToCharArray();
if (chars[0] != '0')
continue;
else
{
string[] sArray = Line1.Split(' ');
foreach (string i in sArray)
radardata.Write(i);
}
}
radardata.Close();
}
}
}