Irrlicht.NET CP’s blog

Trying to fix Vista string issues

Today Thoran tried to fix strings conversion from managed to unmanaged code and back.

Here is what he wrote:

errno_t errValue;
errValue = wcstombs_s(&size, str, (b.length()+1) * sizeof(wchar_t), b.c_str(),sizeof(wchar_t)*b.length());
if (errValue == 42) //returned value for char that could not be converted
str = "Unknown wide-char!";

I guess it’s working now, despite the unclear synopsis of the windows function. I’m wondering do the ms ppl allways create such functions with sometimes ridiculous syntax?

Filed under Uncategorized

Leave a Reply