How do I read value from INI file without using sections?
So instead of normal file:
[section]
name=value
it would result in this:
name=value
I wouldn't call it an INI file, then. Anyhow, for this the TStringList
class fits perfectly.
Consider the file animals.txt
:
dog=Sally
rat=Fiona
cat=Linus
And consider this code:
procedure TForm1.Button1Click(Sender: TObject);
begin
with TStringList.Create do
try
LoadFromFile('C:\Users\Andreas Rejbrand\Desktop\animals.txt');
ShowMessage(Values['dog']);
finally
Free;
end;
end;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With