[Lazarus] Passing an array to a function

Dave Coventry dgcoventry at gmail.com
Tue Jan 20 06:34:43 CET 2009


2009/1/20 Darmawan Sugiarto <darmawan_sugiarto at yahoo.com>:
> Can you give more information about your function.

Sure:


function FieldValueAsString(var fsbuffer: TByteBuffer;
fitype,marker,fisize: integer): string;
begin
  case fitype of
43,52,108:Result:=inttostr(LEtoN(PLongint(@fsbuffer[marker])^));
 50:Result:=inttostr(LEtoN(PSmallInt(@fsbuffer[marker])^));
end;
end;

It was failing before it got there, so I don't think the problem was
with the function.

In any case, Martin's suggestion regarding calling the ReadBuffer
function with the first element of the array rather than the pointer
has worked...



More information about the Lazarus mailing list