bdwibedy
asked on
Problem with BSTR in VC++/DCOM.
For oleautomation I am passing a BSTR from client program.The server is accepting it gracefully, but I want to convert the BSTR variable in server side to a char * or char array.My server can't use MFC as set previously.I tried with OLE2T/T2OLE etc. please help me in this matter.
Thanking u in anticipation,
Baidehish Dwibedy.
India.
Thanking u in anticipation,
Baidehish Dwibedy.
India.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Cheap and dangerous way:
(Only dangerous if localization is an issue)
char buffer[max_buffer_size];
sprintf( buffer, "%S", bstr ); // Note that it's %'capital S'
Or you could use the MultiByteToWideChar function.
(Only dangerous if localization is an issue)
char buffer[max_buffer_size];
sprintf( buffer, "%S", bstr ); // Note that it's %'capital S'
Or you could use the MultiByteToWideChar function.
Sorry, I meant to say the WideCharToMultiByte function.
ASKER