asp.net C#读取中文字符代码
asp教程.net c#读取中文字符代码
private static void fnfileprocess()
{
streamreader reader = new streamreader(@"d:1500.txt", encoding.getencoding("gb2312"));
streamwriter writeren = new streamwriter(@"d:english.txt", false, encoding.utf8, 1024);
streamwriter writerch = new streamwriter(@"d:chinese.txt", false, encoding.utf8, 1024);
try
{
int i = 1;
for (string line = reader.readline(); line != null; line = reader.readline())
{
if (i % 2 == 1)
{
writeren.writeline(line);
}
else
{
writerch.writeline(line);
}
i++;
}
console.writeline(i + "tok");
}
catch (exception ex)
{
console.writeline(ex.tostring());
}
finally
{
//不清空缓冲区,得到的文件总是少几十行
writeren.flush();
writerch.flush();
}
}
补充:asp.net教程,C语言