C# 输出控制台结果到文件

StreamWriter sw = new StreamWriter(@"c:\output.txt");

Console.SetOut(sw);

Console.WriteLine("output content to file");

sw.Flush();
sw.Close();

 

posted on 2013-11-16 09:55  thankyou  阅读(457)  评论(0编辑  收藏  举报