"Nikolay Sivov" bunglehead@gmail.com wrote:
Why do you need to allocate an intermediate roletextA?
WideCharToMultiByte requires to have a sufficient buffer. I think it's the easiest way to allocate necessary buffer instead of using local buffer of some hardcoded length. What do you think?
And what is the problem with WideCharToMultiByte?
No problems with it. The reason is that I couldn't use rolemax as an WideCharToMultiByte argument cause it could be less then required buffer. After that I don't want to use something like CHAR buff[64] because of unexplainable length, so I allocate it in heap. Why it's wrong?
I still fail to see why you can't use rolemax in WideCharToMultiByte, obviously that's the size of the target buffer.