TIP: Click on subject to list as thread! ANSI
echo: delphi
to: GARY WEINFURTHER
from: DANIL LAVRENTIUCK
date: 1997-06-17 14:07:00
subject: TStrings, TIniFile

Приветствую, Gary!
30 May 97 07:21, Gary Weinfurther wrote to Alex Trubin:
 AT>> procedure TForm1.Create(Sender: TObject);
 AT>> var    S1: TStrings;
 AT>> F : string;
 AT>> begin
 AT>> F:='SoMe.InI';
 AT>> S1:= TStrings.Create;
 >>> S1.LoadFromFile(F);    <- Here i have ErroR "EAccessViolation"
 GW> The problem is that you shouldn't be using TStrings.  It has no
 GW> ability to store strings by itself.
But why the error message is so obscure? Why TString don't handle this 
illegal operation?
 GW>   Use TStringList instead.  Or use TIniFile as follows:
 GW>    IniFile := TIniFile.Create('some.ini');
 GW>    try
 GW>        Value := IniFile.ReadString('Section', 'Key', 'DefaultValue');
 GW>    finally
 GW>        IniFile.Free;
 GW>    end;
It's not a solution. He needs to get a list of all keys in section. Work with 
single key - is a wrong way.
        That's all.. Good Luck!
                                            Danilka The Master
E-Mail: arilou@laes.sbor.ru - try to use it, m.b. it'll be faster...
---
---------------
* Origin: Leningrad Nuclear Power Plant ( Sosnovy Bor ) (2:5030/548)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.