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

Offline matze

  • Member
  • *
  • Posts: 4
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: 1882
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