I got a piece of code that works under Multi-Byte Character Set. However, I want to convert this piece of code to UNICODE. So I fixed lots of stuff, but failed at the strncpy() line. This is the line that I want to change:
strncpy(a.szTip, szToolTip, bLength);
I used lots of functions to fix this, but all of them failed.
Here's the error:
strncpy cannot convert parameter 1 from WCHAR[128] to char *
When dealing with wide characters, use wcsncpy()
(and other relevant functions).
As Remy Lebeau points out, using the _tcsncpy()
macro is safer if you want to support both ANSI & Unicode builds (it expands to the right function respectively).