一个数据结构的问题。(50分)

  • 主题发起人 coolingxyz
  • 开始时间
C

coolingxyz

Unregistered / Unconfirmed
GUEST, unregistred user!
type //我自己定义的一个结构
TstrMk = packed record //插槽结构
OffOn : Boolean;
Index : Integer;
//插槽
Style : Integer;
//设备型号
Led : Integer;
//灯
end;

TstrJj = packed record //机架结构
OffOn : Boolean;
Index : Integer;
Temperature : string;
mk : Array[0..15] of TstrMk;
end;

PstrIp = ^TstrIp;
TstrIp = packed record
Ip : string;
Jj : Array[0..15] of TstrJj;
end;


public //主程序单元里
PFhIp : Array of PstrIp;
//TstrIp指针数组。
//Formcreat事件中
setlength(PFhIp,9);
For i := 0 to 8do
begin
GetMem(PFhIp,sizeof(TstrIp));
//(怀疑这里有问题)
PFhIp^.Ip :='192.168.3.10'+inttostr(i);
//这里有时要出错
end;

请教大家。
 
var
i:Integer;
begin
setlength(PFhIp,9);
For i := 0 to 8do
begin
new(PFhIp);
//采用标准的结构指针内存分配过程—— New
PFhIp^.Ip :='192.168.3.10'+inttostr(i);
//这里有时要出错
end;
end;

Done!
 
谢谢你creation-zy ,给你加50分! ;)
 
顶部