var aa:Tstringlist;
    i,len:integer;
    ss:string;
aa:=Tstringlist.create;
aa.loadfromfile('yourfile');
len:=aa.count-1;
for i:=0 to len do
begin
  ss:=aa[i];
  Myprocess(ss);
end;
aa.free;

解决方案 »

  1.   

    我对 pascal 不是很熟,试过用自定记录的方法,但格式不一样,请大师指教!!
      

  2.   

    如果是数据对不上号,加上个packed试一试。
    你这是一个纪录条,还是一个纪录块?
      

  3.   

    請教:
    什么是:PACKED 就是數據對不上號,這是一條條的記錄,
    FTP 用文本模式下載的.
      

  4.   

    我定义一个记录类型。type
     palpsd=record
      PAL01:string[17];
      PAL011:string[9];
      PAL012:string[7];
      PAL0121:string[1];
      PAL0122:string[6];
      PAL013:string[2];
      PAL02:string[20];
      PAL03:string[4];
      PAL03_N:string[5];
      PAL04:string[4];
      PAL04_N:string[5];
      PAL05:string[4];
      PAL05_N:string[5];
      PAL_FIL:string[4];
     end;var
    palmast:file of palpsd;
    paldata:palpsd;
    fileName:string;
    RecSize,CurRec:longint;
    但读出来的记录位置不对。 不知是什么原因??
      

  5.   

    加个packed试试palpsd= packed record
      PAL01:string[17];
      PAL011:string[9];
      PAL012:string[7];
      PAL0121:string[1];
      PAL0122:string[6];
      PAL013:string[2];
      PAL02:string[20];
      PAL03:string[4];
      PAL03_N:string[5];
      PAL04:string[4];
      PAL04_N:string[5];
      PAL05:string[4];
      PAL05_N:string[5];
      PAL_FIL:string[4];
    end;
      

  6.   

    不要用string.
    用array of char

    palpsd= record
      PAL01:array [0..16] of char;
      PAL011:array [0..8] of char;
      ......
    end;
    String实际是一个指针,所以String[0]实际上存放的是字符的大小,这样在大小的计算上会出现问题.
    相对来说,要读文件时还是用Char这些通用一些的类型为好.
      

  7.   

    多谢  bokei(一夜好眠)  指教!!