In the C++ Inventor programming examples I see a lot of uses of the T string macro. I imagine this is to handle both wchar_t and char strings. But with recent OSs can I safely always use wchar_t? How many people are using Inventor in a system which is not default UNICODE?
I know UNICODE and wchar_t are not identical, but you get the gist of my question. I want to always use wchar_t without having to use those untidy _T macros.
Solved! Go to Solution.
Solved by adam.nagy. Go to Solution.
Hi,
My understanding is that the use of those macros is just to enable you to compile your project to be Unicode enabled or not. E.g. when long ago AutoCAD was adding Unicode support and you still wanted to compile your project for an older version that did not support Unicode then using these macros it was a matter of compiler setting switch to compile for one version then to another version.
C++ Project Settings >> "Configuration Properties" >> "General" >> "Character Set" = "Use Unicode Character Set"
If your project is always built with Unicode support switched on then I don't think you'd need those _T macros.
It's your decision. 🙂
Cheers,
Hi,
Yes, I think that should be fine. You of course have to check what type of string a given function is requesting. In case of calling Inventor API functions the strings are required as BSTR (sometimes wrapped in a VARIANT) which you can get in multiple ways and I think all of them can create it from wchar_t: SysAllocString, CComBSTR, _bstr_t
http://stackoverflow.com/questions/3323177/c-convert-wchar-t-to-bstr
Cheers,