[fpc-pascal] String concatenation failure (again)
Jürgen Hestermann
juergen.hestermann at gmx.de
Wed Aug 3 15:16:15 CEST 2016
Am 2016-08-02 um 20:12 schrieb José Mejuto:
> Check the length of the string I think you have a NULL char at the end of every string, so only the first one (up to #00 char) is displayed.
Yes, you are right.
When I change the code
----------------------------
for i := Low(Liste) to High(Liste) do
S := S+Liste[i]+LineEnding;
----------------------------
to
----------------------------
for i := Low(Liste) to High(Liste) do
S := S+pchar(Liste[i])+LineEnding;
----------------------------
then it works okay.
The Win-API call retrieves the ending null byte too
so it ends up in my array of strings.
Strange is that it already worked with FPC 2.x.
Of course I had to convert UTF16 to UTF8 manually
but I don't have the old code anymore.
It could be that I had to use pchar in that case too which
would explain why it worked before (I then removed
"unneccessary" convertion routines and it seems
I removed the pchar calls too).
More information about the fpc-pascal
mailing list