看一下这个数据结构定义。(100分)

L

liu-yb

Unregistered / Unconfirmed
GUEST, unregistred user!
在C里的定义是这样的:
type struct tagdata
{ DWORD data1;
DWORD data2;
union
{DWORD data3;
time_t time1;
};
char char1[64];
}datastr;

我在DELPHI中写为:
tagdata=packed record
data1:longword;
data2:longword;
case Integer of
0:(data3:longword);
1:(time1:ttime);
end;
char1:array of [1..64] of char;
end;

问题:这样定义不能通过。
 
tagdata=packed record
data1:longword;
data2:longword;
case Integer of
0:(data3:longword);
1:(time1:ttime);
end;
char1:array of [1..64] of char;
end
^^此处错了,删掉即可
 
不对,把最后的(END;)删除,结构就变为两个了。
char1:array of [1..64] of char;//就变成独立的结构了。
 
可变纪录的变化部分好像必须在纪录的最后部分
 
type
temptype=packed record
case Integer of
0:(data3:longword);
1:(time1:ttime);
end;

tagdata=packed record
data1:longword;
data2:longword;
x:temptype;
char1:array[0..63] of char;
end;
 
谢谢各位!
 
顶部