[fpc-devel] copy for PChar

Mattias Gaertner nc-gaertnma at netcologne.de
Sun Feb 19 17:42:03 CET 2012


On Sun, 19 Feb 2012 17:31:48 +0100 (CET)
marcov at stack.nl (Marco van de Voort) wrote:

> In our previous episode, Mattias Gaertner said:
> > When I use "copy" on a PChar (e.g. copy(p,1,1)), it is very slow,
> > because the compiler converts the PChar to a string.
> > 
> > Is there already a function for PChar?
> 
> http://www.freepascal.org/docs-html/rtl/strings/strlcopy.html 

Thanks. But apparently I was not exact enough.

"Copy" has the nice feature, that the bounds are checked.
For PChar it does that too, but it always runs through the whole PChar
to #0.
And I need an Ansistring as result.


Mattias



More information about the fpc-devel mailing list