Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

TIni Help Please !!

0 views
Skip to first unread message

The Reverend PimpDaddy

unread,
Apr 28, 2001, 12:25:45 PM4/28/01
to
Hi all,

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 :)

Rappido

unread,
Apr 28, 2001, 11:52:43 AM4/28/01
to
The Reverend PimpDaddy <j...@tri.net> wrote:
>Hi all,
>
>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.
>
>

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;

Rappido

unread,
Apr 28, 2001, 11:55:43 AM4/28/01
to
The Reverend PimpDaddy <j...@tri.net> wrote:
>Hi all,
>
>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.
>
>

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

The Reverend PimpDaddy

unread,
Apr 28, 2001, 10:26:15 PM4/28/01
to
On 28 Apr 2001 08:52:43 -0700, Rappido <rap...@detrio.nl> wrote:


Thanks for the help :)


I really appreciate it !!

Rev. PimpDaddy

0 new messages