problem with ReadSectionValues
Posted on 1999-01-16
I have problems to read the values from a *.ini file.
I created this myprog.ini file:
[Path of my program]
With the help of the following routine, I would like to copy the string
procedure TForm1.Button1Click(Sender: TObject);
i, position: integer;
myprogIni := TIniFile.Create('myprogram.ini');
sl := tstringlist.create;
myprogIni.ReadSectionValues('Path of my program', sl);
for i := 0 to sl.count - 1 do
temp := sl.strings[i];
position := pos('=', temp);
delete(temp, 1, position);
edit1.text := temp;
However when I run my demo program, the variables "temp" and "sl"
are always empty, although my demo program and myprog.ini are both
in the same direcory and do of course both exist. But edit1.text is always
blank and I can never see C:\MYPATH in this field.
Can you please tell me, what I am doing wrong here?
With kind regards