On Sun, Nov 13, 2011 at 1:39 AM, Rainer Stratmann
<rainerstratm...@t-online.de> wrote:
> procedure getchars( p : pchar );
> var l : longint;
> begin
>  l := length( p );
> end;

You cannot do length in a PChar, it has no length information. I think
this code is probably automatically converting the PChar to a Pascal
String and then after that calling Length in the Pascal String, so
your code is not very efficient.

Pass the length of the PChar in an aditional parameter instead. Or
write a routine which will count until the first #0 of the PChar to
see how many characters it has.

-- 
Felipe Monteiro de Carvalho
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to