Log in

View Full Version : Iterate Keys in an INI file..



Brandon
01-16-2012, 04:53 AM
How can I get how many Keys are under a section in an INI file through Iteration?
I don't have a single clue how many keys are in the file but I know exactly what section to look under.

Edit Nvm.. Sorta found a temp fix:


SetLength(Food, 12);
For I:= 0 To 11 do
begin
Food[I]:= ReadINI('Food', 'Key[' + ToStr(I) + ']', ScriptPath + 'AZKInfo.INI');
end;
For I:= 0 To High(Food) do
begin
if (Food[I] <> '') then
J:= J + 1;
end;
SetLength(Food, J);

tls
01-16-2012, 05:17 AM
Store the count under a different key in the INI

Wizzup?
01-16-2012, 10:52 AM
You could alternatively use Simba's Settings API... I'm thinking of slightly modifying it so you can define your own file.