You do not need length specifier. The delimiter clearly delimits the parts of the array.
if you have a section in INI file defined like this
[TestSection]
val1 = 1,2,3,4,5,6,7
then all you have to do is
procedure TForm1.ReadFromIniFile;
var
I: Integer;
SL: TStringList;
begin
SL := TStringList.Create;
try
SL.StrictDelimiter := True;
SL.CommaText := FINiFile.ReadString('TestSection', 'Val1', '');
SetLength(MyArray, SL.Count);
for I := 0 to SL.Count - 1 do
MyArray[I] := StrToInt(Trim(SL[I]))
finally
SL.Free;
end;
end;
procedure TForm1.WriteToIniFile;
var
I: Integer;
SL: TStringList;
begin
SL := TStringList.Create;
try
SL.StrictDelimiter := True;
for I := 0 to Length(MyArray) - 1 do
SL.Add(IntToStr(MyArray[I]));
FINiFile.WriteString('TestSection', 'Val1', SL.CommaText);
finally
SL.Free;
end;
end;