F
fooshm
Hello,
I'm trying to convert a String^ to LPCTSTR.
When using :
LPCTSTR str =
static_cast<LPCTSTR>(Marshal::StringToHGlobalAnsi(gcString).ToPointer());
in order to convert how ever I'm receiving junk string.
When using a longer cast example I found on the net:
lpsConverted = static_cast<LPCTSTR>(const_cast<void*>(static_cast<const
void*>(System::Runtime::InteropServices::Marshal::StringToHGlobalAnsi(sString))));
I'm also receiving junk.
Currently the only way to do it is using CString cast:
CString* tmpStr = new CString(sString);
return (LPCTSTR)(*tmpStr);
I'm probably missing something on my Marshal code, does anyone have a
clue ?
Thank you,
Efi
I'm trying to convert a String^ to LPCTSTR.
When using :
LPCTSTR str =
static_cast<LPCTSTR>(Marshal::StringToHGlobalAnsi(gcString).ToPointer());
in order to convert how ever I'm receiving junk string.
When using a longer cast example I found on the net:
lpsConverted = static_cast<LPCTSTR>(const_cast<void*>(static_cast<const
void*>(System::Runtime::InteropServices::Marshal::StringToHGlobalAnsi(sString))));
I'm also receiving junk.
Currently the only way to do it is using CString cast:
CString* tmpStr = new CString(sString);
return (LPCTSTR)(*tmpStr);
I'm probably missing something on my Marshal code, does anyone have a
clue ?
Thank you,
Efi