问题1:用FileOpen(c:\aa.txt)打开一文件后用FileWrite是向下追加数据还是重头开始写(此文件中已有数据)问题2:写完一行怎么回车?也用FileWrite吗?如果是,那回车怎么表达?

解决方案 »

  1.   

    1.先用Seek函数指定文件指针到最后,然后写入
    2。写入#13#10既是回车换行
      

  2.   

    var
       f : TextFile;
    begin
       AssignFile(f, 'c:\aa.txt');
       //ReSet(f);Readln(f, s);//读文件
       ReWrite(f);//从新写文件
       //Append(f)//从原文件尾添加
       Write(f, 'aaaaaa');//Writeln()写完后自动回车
       CloseFile(f);
    end;
      

  3.   

    我写一个示例给你:
    这个为向原先的文件加记录!
    if FileExists(syspath+'data\info.cxj')=false then
            begin
            assignfile(flog,syspath+'data\info.cxj');
            rewrite(flog);
            write(flog,'');
            closefile(flog);
            close;
            end;
             assignfile(flog,syspath+'data\info.cxj');
             Append(flog);//这个是重点!
             Writeln(flog, slog);
    好了,绝对正确!
    给分吧!!!!!!!!!!!!!!!!!!!!!!!!
      

  4.   

    1.用Seek指最后
    2.写入#13#10既是回车换行
    3.用流吧
      

  5.   

    if FileExists(syspath+'c:\aa.txt')=false then
            begin
            assignfile(flog,syspath+'c:\aa.txt');
            rewrite(flog);
            write(flog,'');
            closefile(flog);
            close;
            end;
             assignfile(flog,syspath+'c:\aa.txt');
             Append(flog);//这个是重点!
             Writeln(flog, slog);
    好了,绝对正确!文件都用你的了,只要是文本文件都可以这样的!
    给分吧!!!!!!!!!!!!!!!!!!!!!!!!