O
own_delphi
Unregistered / Unconfirmed
GUEST, unregistred user!
记录类型为 delphi SegmentContentInfoTag = record nSegmentIndex : integer; nConentId : integer; nNoteIndex : integer; nDataLen : integer; pdata : array[0..1024-1] of char; end; pSegmentContentInfoTag = ^SegmentContentInfoTag;C++原型结构typedef struct SegmentContentInfoTag{ unsigned int nSegmentIndex; int nConentId; int nNoteIndex; int nDataLen; char *pdata; } SegmentContentInfo;我写的循环取数据如下:第一个取出没有问题,但是下一个就无法获取function GetSegment(aContentID : integer): Boolean;var SegInfo : pSegmentContentInfoTag; nSegmentNumber : pinteger; iNumber,i,j,iSeg : integer; bSeg : Boolean; s,sall : String; seg : pchar; iDataLen : integer;begin new(nSegmentNumber); SegInfo := AllocMem (1024*2); iDataLen := 0; bSeg := GetContentInfo(aContentID,nSegmentNumber,SegInfo);//Dll中C的方法, if (bSeg) then begin iNumber := nSegmentNumber^; for i:= 1 to iNumber do begin iSeg := SegInfo^.nDataLen; for j :=0 to iSeg-1 do begin s := SegInfo^.pdata[j]; sall := sall+s; end; sall := Copy(sall,1,iSeg); inc(SegInfo,4);//这里有问题 end; end; Dec(SegInfo, iNumber*4); FreeMem(SegInfo, 1024*2); dispose(nSegmentNumber);end;