我先用一个动态的一维数组SectionsArray保存了index.ini中的所有sections值
var
i,j:integer;
SectionsArray:Array of string;
begin
Filename:=ExtractFilePath(Paramstr(0))+'\include\Index.ini';
IndexIni:=TiniFile.Create(Filename);
List:=TStringList.Create;
IndexIni.ReadSections(List);
j:=List.count;
SetLength(SectionsArray,j);
for i:=0 to j-1 do
begin
SectionsArray[i]:=List[i] ;
end;
end;于是我就想用一个动态的三维数组保存section,key,value
如果有section下的key有1000多个,而有的section下的key只有3个,这样的话会不会特浪费空间请问一下有没有其他更好的办法,找了资料没有找到.
var
i,j:integer;
SectionsArray:Array of string;
begin
Filename:=ExtractFilePath(Paramstr(0))+'\include\Index.ini';
IndexIni:=TiniFile.Create(Filename);
List:=TStringList.Create;
IndexIni.ReadSections(List);
j:=List.count;
SetLength(SectionsArray,j);
for i:=0 to j-1 do
begin
SectionsArray[i]:=List[i] ;
end;
end;于是我就想用一个动态的三维数组保存section,key,value
如果有section下的key有1000多个,而有的section下的key只有3个,这样的话会不会特浪费空间请问一下有没有其他更好的办法,找了资料没有找到.
解决方案 »
- 60分求 读取TXT的第一行,读完后删除TXT里的第一行!谢了!!!!!!!!!!!
- 编译问题?
- 这是不是DELPHI的BUG啊,请大家进来看看!急
- 文件读写问题,非常急~
- 请问怎么创建这样子的透明窗体?
- 有关ShellExecute频繁调用会造成死机??
- 主窗体释放Dll窗体??
- 在delphi中,这个查询怎么写?
- 请问两个关于数据库的处理流程
- 提个和DELPHI不相干的问题,请问UNIX编程学习之前要掌握哪些东西?
- 串口MSComm读取内容不对,用ComPort.exe读取是正确的的十六进制,我下面写的程序有时候会把后面的截掉
- 怎么把JPEG、BMP,wmf等Timage支持的格式转化为TIFF?
我的index.ini中的sections,key,vlues都是未知的,
TMemIniFile
请问怎么个读法?
ReadSection(sectionName,...)取得sectionName的所有key
var
fl:TINIFile;
str_section,str_key:TStrings;
i,j,m,n:Integer;
s,s1,s2:string;
begin
fl:=TIniFile.Create('c:\param.ini');
str_section:=TStringList.Create;
str_section.Clear;
str_key:=TStringList.Create;
str_key.Clear;
fl.ReadSections(str_section);
i:=str_section.Count;
if i=0 then
Exit;
for j:=0 to i-1 do
begin
s:=str_section.Strings[j];
fl.ReadSection(s,str_key);
m:=str_key.Count;
if m=0 then
Continue;
for n:=0 to m-1 do
begin
s1:=str_key.Strings[n];
s2:=fl.ReadString(s,s1,'');
.......................
end;
end;
end;