Is there a unified cout/wcout to handle char* and wchar*
I am not sur开发者_StackOverflow社区e if there is a unified way to handle char* and wchar* in Visual c++?
A reasonably convenient way to handle both wchar
and char
strings is via bstr_t, which can be constructed from either and cast to either.
Under the covers, this class uses the required Win32 character conversion APIs to ensure correct output. It's really a COM helper class (BSTR
is the COM string type), but no reason why you cannot use it even if you don't need COM.
精彩评论