[Lazarus] strcat problem

Koenraad Lelong lazarus2 at de-brouwerij.be
Fri Jun 24 09:43:19 CEST 2016

Op 23-06-16 om 21:38 schreef Martin Grajcar:
> Have you checked if there's any room behind #13'Now is the winter of our
> discontent'#13, so that someone else's memory won't get overwritten? I'd
> bet, there's none.
> /Appends a copy of the source string to the destination string. The
> terminating null character in destination is overwritten by the first
> character of source, and a null-character is included at the end of the
> new string formed by the concatenation of both *in destination*./
> You'd need something like
> SetLength(cTekst, enoughToHoldThemAll);
> and maybe also
> cTekst[oldLength] := #0;
> before the very first strcat.
Updated my code :

  cTekst:=#13'Now is the winter of our discontent'#13;
  cTekst:=StrCat(cTekst,'Made glorious summer by this sun of York;'#13);

cTekst is still a PChar.

Same problem : on the pi the program crashes on the first StrCat with a 
216 error.

An extra error, now on my OpenSuse-box :
I finally do
And then the application crashes with a 216 error. Leaving that 
StrDispose out it runs fine, but then there's a memory-leak.

FWIW, I'm using FPC 2.6.5 (SVN version 49333M) on OpenSuse and 3.0.0 on 
the pi.


More information about the Lazarus mailing list