I am encountering an error when I try to use memcpy on a wchar_t string. Specifically, despite the length I am sending in to memcpy being correct for the length of the string I want to copy, only the first half of the characters in the string are copied over. This leaves me with bad data in the target string, since the latter half of the string is full of garbage characters left over from new-ing up the string.
Screenshot below shows the exact problem I am dealing with:
The only thing I can think of is that this might be somehow related to me having my locale set to Japanese for non-Unicode applications, but the first thing I did was to change the locale back to English and the problem remains the same. I feel like there is a really obvious solution that I am missing. Any ideas?