[fpc-pascal] about dynamic array

cobines cobines at gmail.com
Fri May 7 06:10:30 CEST 2010


2010/5/6 spir ☣ <denis.spir at gmail.com>:
> (By the way, started playing with TFPList already, and could not find how to get data back! I mean the symtric of add(). Even tried indexing (who knows, with the syntactic magic of modern language? ;-).)

It is indexing.

var
  l: TFPList;
  p: Pointer;
  index: Integer;
begin
  l := TFPList.Create;
  index := l.Add(p);
  p := l[index];
end;

You can use it like an array too:

var
  l: TFPList;
begin
  l := TFPList.Create;
  l.Count := 20;
  // now you have l[0]..l[19] elements for read/write
end;


--
cobines



More information about the fpc-pascal mailing list