如何用代码实现: 如果硬盘上已经存在 aa.txt ,并且文件中已经有信息,如何往 aa.txt 中追加信息呢?

解决方案 »

  1.   

    FileInfo file = new FileInfo("c:\\aa.txt");
    file.AppendText("hello,world!");orStreamWriter writer = new StreamWriter("c:\\a.txt",true);
    writer.WriteLine("hello,world!");writer.WriteLine("ni hao ma ?");
    writer.Flush();
    writer.Close();
      

  2.   

    FileStream fs = new FileStream(//参数);
    StreamWriter sw = new StreamWriter(fs);
    sw.CaseOrigin.Seek(0,Origin.Append);
    sw.WriteLine(//写的东西);
    对不起了, 大概这样,自己点出属性自己看,
    我这VS卸了,只是凭记忆写的,
    咳!~ 平时太依赖智能提示了....
      

  3.   

    ------------------------------------------
    欢迎加入我的程序设计QQ群80532706哟
    请注册bbs.bbs180.com,并写清把ID号,然后加入群。