while not eof(fp1) do
begin
  ch := read(fp1) ;
  write(fp2 ,ch) ;
end ;

解决方案 »

  1.   

    直接用stringlist来写,很方便。
      

  2.   

    谢谢楼上各位,不过,这个读写过程需要一些处理,比如增删一些字符。他怪就怪在有的文件使用她一点问题也没有,有的文件到了一定的地方就出错。
    var
     fI,fO: textfile;
     s,car,ts: string;
     c: char;
    implementation
    procedure ReadBlock(i,j: integer);
    var
     m,n: integer;
    begin
     s:='';
     for m:=1 to i do
      begin
       for n:=1 to j do
        begin
         read(fI,c);
         s:=s+c;
        end;
       s:=s+',';
      end;
    end;
    procedure ANGRtoTXT(FNo: string);
    var
     tims,i: integer;
    begin
     assignfile(fI,'000.tmp');
     reset(fI);
     assignfile(fO,FNo);
     rewrite(fO);
     repeat
      begin
       readblock(1,8);
       ts:=s;
       readblock(1,5);
       ts:=ts+s;
       readblock(1,1);
       s:='';
       for i:=1 to 5 do
        begin
         read(fI,c);
         s:=s+c;
        end;
       tims:=trunc((strtoint(s)-8)/6);
       s:='';
       read(fI,c);
       if c='1' then
        begin
         write(fO,ts);
         readblock(1,6);
         write(fO,s);
         readblock(1,1);
         readblock(tims,6);
         write(fO,s);
        end
       else
        begin
         readblock(1,7);
         readblock(tims,6);
         write(fO,s);
        end;
       repeat
        begin
         read(fI,c);
         if c='1' then
          begin
           write(fO,#13#10);
           write(fO,ts);
           readblock(1,6);
           write(fO,s);
           readblock(1,1);
           readblock(tims,6);
           write(fO,s);
          end
         else
          begin
           readblock(1,7);
           readblock(tims,6);
           write(fO,s);
          end;
        end;
       until eoln(fI);
       readln(fI);
       write(fO,#13#10);
      end;
     until eof(fI);
     closefile(fI);
     assignfile(fI,'111.tmp');
     reset(fI);
     repeat
      begin
       readblock(1,8);
       ts:=s;
       readblock(1,5);
       ts:=ts+s;
       readblock(1,1);
       s:='';
       for i:=1 to 5 do
        begin
         read(fI,c);
         s:=s+c;
        end;
       tims:=trunc((strtoint(s)-8)/6);
       s:='';
       read(fI,c);
       if c='1' then
        begin
         write(fO,ts);
         readblock(1,6);
         write(fO,s);
         readblock(1,1);
         readblock(tims,6);
         write(fO,s);
        end
       else
        begin
         readblock(1,7);
         readblock(tims,6);
         write(fO,s);
        end;
       repeat
        begin
         read(fI,c);
         if c='1' then
          begin
           write(fO,#13#10);
           write(fO,ts);
           readblock(1,6);
           write(fO,s);
           readblock(1,1);
           readblock(tims,6);
           write(fO,s);
          end
         else
          begin
           readblock(1,7);
           readblock(tims,6);
           write(fO,s);
          end;
        end;
       until eoln(fI);
       readln(fI);
       write(fO,#13#10);
      end;
     until eof(fI);
     closefile(fI);
     closefile(fO);
    end;