I have a simple question regarding TIni. I want to extract all of the
the "Section Keys" ...I think they are called... from within a .ini
file.
Basically I want to get "Ftp.Microsoft.com" and "Ftp.Cnet.com"
from the example below and put them into a listbox.
[ftp.microsoft.com]
Address=ftp.microsoft.com
username=anonymous
password=m...@here.com
Port=21
[ftp.cnet.com]
Address=ftp.cnet.com
username=anonymous
password=m...@here.com
Port=21
I know I can easily parse the .ini and get the results just wondering
if a procedure already exists to do this.
Thanks In Advance
The Reverend :)
procedure TForm1.FormCreate(Sender: TObject);
var
sl: TStringList;
begin
with TIniFile.Create(<FileName>) do
try
sl := TStringList.Create;
try
ReadSection('ftp.Microsoft.com', sl);
<do whatever you want with sl>
<sl.Strings[0] will be Address=ftp.microsoft.com in you example>
finally
sl.Free;
end;
finally
Free;
end;
end;
I didn't read you question right so here a second answer
var
sl: TStringList;
begin
with TIniFile.Create(<FileName>) do
try
sl := TStringList.Create;
try
ReadSections(sl)
finally
sl.Free;
end;
finally
Free;
end;
ReadSection must be ReadSections
Thanks for the help :)
I really appreciate it !!
Rev. PimpDaddy