String conversion

  • Thread starter Thread starter Gideon
  • Start date Start date
G

Gideon

is there a simpler way then this ->
static_cast<char*>(System::Runtime::InteropServices::Marshal::StringToHGloba
lAnsi(str).ToPointer());



to convert a System::String to a char*.

also , any simple way to convert System::String to Std::String?



thanks.
 
Not familiar with C++ syntax, I am assuming char* is a character array. If
so, you can do one of the following:

characterArray = someString.ToCharArray()
or
Convert.ToBase64CharArray(someString)

Apologies for being dense on C++, but this should at least give a pointer.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

**********************************************************************
Think Outside the Box!
**********************************************************************
 
MC++ allows direct access to the characters of a String
object for high-performance calls to unmanages functions
that take wchar_t*


String* str=S"ABCDEF";
const wchar_t __pin* pinchars=PtrToStringChars(str);

Now feel free to operate with pinchars in unmanaged code

Michaedl
 
Back
Top