Home » Community » Newbie corner » [Resolved] char* with "\0" between each char (Char* returned from OLE VARIANT is weird)
Re: char* with "\0" between each char [message #50985 is a reply to message #50876] |
Wed, 16 January 2019 09:17 |
|
Xemuth
Messages: 387 Registered: August 2018 Location: France
|
Senior Member |
|
|
Hello Again,
I have resolved my problem, the char * I tried to read was a bstr.
To make it readable as normal char * it need to be cast to ASCII char * via this kind of func :
void BSTRtoASC (BSTR str,char * resultat){
if ( str != NULL ) {
unsigned long length = WideCharToMultiByte (CP_ACP,0, str,SysStringLen(str), NULL, 0,NULL, NULL );
length = WideCharToMultiByte (CP_ACP,0, str,SysStringLen(str), resultat, length,NULL, NULL );
resultat[length] = '\0';
}
}
Have a good day
[Updated on: Wed, 16 January 2019 11:04] Report message to a moderator
|
|
|
Goto Forum:
Current Time: Mon Apr 29 08:39:07 CEST 2024
Total time taken to generate the page: 0.02911 seconds
|