[Lazarus] strcat problem

Sven Barth pascaldragon at googlemail.com
Fri Jun 24 07:59:17 CEST 2016


Am 23.06.2016 21:41 schrieb "David W Noon" <david.w.noon at googlemail.com>:
> > Op 23-06-16 om 16:58 schreef David W Noon:
> >> [snip]
> >>> cTekst:=#13'Now is the winter of our discontent'#13;
> >>
> >> You need a trailing #0 byte on the end.
> >>
> >
> > The definition of cTekst : var cTekst : PChar;
> >
> > So the compiler knows cTekst is a 0-terminated string doesn't, it
> > ?
>
> The cTekst variable is actually a pointer.
>
> It's the string literal that needs the trailing NUL byte.

The compiler guarantees that constant strings are NUL terminated. This is
needed for easy conversion to PChar.

Regards,
Sven
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20160624/6079429c/attachment-0002.html>


More information about the Lazarus mailing list