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
天書 閱讀(811)
評論(0) 編輯 收藏 引用