数组转换(50分)

N

nethero

Unregistered / Unconfirmed
GUEST, unregistred user!
我现在遇到一个问题求教各位大侠:
我定义了如下变量:
up_mb:Taaray2
Tarray2=array of TZDP
TZDP=record
hres:integer;
zres:integer;
direct:integer;
flag:char;
end;
现在我要把up_mb中的数据写入以ini文件中去,我该如何转换?
 
为什么没人回答我,是不十分太少还是问题太菜?
不过还是请高手帮帮我!!!
 
这个你可以自己定义呀。
比如:
[common]
arraycount=2
[array1]
hres=0
zres=1
direct=2
flag=flag1
[array2]
hres=1
zres=2
direct=3
flag=flag2
 
读写上面的INI文件使用标准Api函数就可以了。
 
writestring()即可了!什么地方不明白?
 
问题是这样的,现在我并不知道up—mb里有哪些数据呀,因为up—mb中的数据
是由一个函数写入的,现在我就是要把这些数据取出来。能告诉我再详细点吗?谢谢!
 
知道它的结构就可以了。使用
up_mb^.hres
up_mb^.zres
up_mb^.direct
up_mb^.flag
不就得到了吗?
 
var i : Integer;
ini : TIniFile;
const optionstr = 'Your Option';
begin
ini := TIniFile.Create('YourFileName');
for i := low(up_mb) to high(up_mb)do
begin
ini.WriteInteger(optionstr,'up_mb'+inttostr(i),up_mb.hres,);
ini.WriteInteger(optionstr,'up_mb'+inttostr(i),up_mb.zres):
ini.WriteInteger(optionstr,'up_mb'+inttostr(i),up_mb.direct):
ini.WriteInteger(optionstr,'up_mb'+inttostr(i),ord(up_mb.flag));
end;
ini.Free;
end;
 
谢谢各位大侠。送上薄礼:)
 

Similar threads

顶部