String curRowText = "Hello!"
FileStream fs = new FileStream("D:\\file.txt",FileMode.Append,FileAccess.Write);
StreamWriter sw = new StreamWriter(fs);
sw.Flush();
sw.Write(curRowText);
sw.Flush();
sw.Close();或者:
StreamWriter writer = null;
try
{
writer = new StreamWriter(strFileName, true);
writer.WriteLine(strCmdText);
}
catch (Exception ex)
{
//进行异常处理
}
finally
{
if (writer != null) writetofile.Close();
}
return false;
posted on 2008-09-03 18:17
天书 阅读(799)
评论(0) 编辑 收藏 引用