我要把ini文件里的值赋给结构体数组,为什么每次GetPrivateProfileStruct返回的值都是0,现在的数组得不到值,请大家帮我看下,代码如下:
var
  Form1: TForm1;
 type  rec=record
    len: integer;
    para: real;
  end;
  trec= array of rec ;
implementation{$R *.dfm}procedure TForm1.FormCreate(Sender: TObject);
var ini:TIniFile;
    cnt,i:Integer;
    re:trec;
    rst:boolean;
begin  comm1.StartComm;
    ini:=TIniFile.Create(ExtractFilePath(Application.ExeName)+'data.ini');
   cnt:= StrToInt(ini.ReadString('type','count','0'));
   SetLength(re,cnt);
   for i:=0 to cnt do
   begin
  rst:= GetPrivateProfileStruct(pchar('type'),pchar('data'+inttostr(i)), @re,sizeof(rec),pchar(ExtractFilePath(Application.ExeName)+'data.ini'));
  if rst then
   listbox1.Items.Add(inttostr(re[i].len));
   end;
end;正面是INI文件内容:
[type]
count=8
data0=B4000000CDCC4C42DB
data1=A00000000000224204
data2=9600000066660E42B2
data3=8C0000000000F841C5
data4=820000009A99D541CB
data5=780000006666B6413B
data6=C800000066668A4260
data7=640000000000804125