NO

Author Topic: Char \0 in UNICODE strings  (Read 1267 times)

matze

  • Guest
Char \0 in UNICODE strings
« on: September 14, 2019, 08:44:10 PM »
If a Unicode string consists of several consecutive strings, problems occur when accessing the strings.
For this I have created two test programs with Pelles C 9.00.9 (see pictures).
In the first picture everything works as expected.
In the second picture you can see the test program slightly modified: A space has been replaced by the character \0.
The source code tries to put the pointer string2 on the first character after the character \0. As can be seen in the second picture, this did not work out, because the debugger displays strange values when the variable string2 is shown.
« Last Edit: September 14, 2019, 09:04:56 PM by matze »

Offline TimoVJL

  • Global Moderator
  • Member
  • *****
  • Posts: 2091
Re: Char \0 in UNICODE strings
« Reply #1 on: September 15, 2019, 01:53:54 AM »
lstrcpy copy only 4 TCHARs to string, so the rest are just current stack values.
May the source be with you