[fpc-pascal] PChar -> AnsiString -> PChar = memory leak?
Graeme Geldenhuys
graemeg.lists at gmail.com
Thu Oct 29 15:38:44 CET 2009
2009/10/29 Henry Vermaak <henry.vermaak at gmail.com>:
>
> This is probably dependant on compiler modes?
I'm using: $mode objfpc
> You may have to do it like this:
>
> StrDispose(Text);
> Text := StrAlloc(length(s) + 1);
> StrPCopy(Text, s);
Ah, now it works plus no memory leaks.
Thanks! :-)
Wow, something as simple as concatenating string and end up being so
complex. Poor C programmers that have to constantly work with pointers
and null terminated strings. ;-)
--
Regards,
- Graeme -
_______________________________________________
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/
More information about the fpc-pascal
mailing list