Alex Trubin mentioned this to All:
AT> Can someone help me with following problem:
AT> I try to open and to read file 'SOME.INI'
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"
The problem is that you shouldn't be using TStrings. It has no ability to
store strings by itself. Use TStringList instead. Or use TIniFile as
follows:
IniFile := TIniFile.Create('some.ini');
try
Value := IniFile.ReadString('Section', 'Key', 'DefaultValue');
finally
IniFile.Free;
end;
...Gary
--- GoldED 2.41
---------------
* Origin: Nobody expects the Flying Circus BBS! (1:2410/905)
|