C++ Interop, _gc Strings to _nogc char*

U

Urs Vogel

Hi

Is there a similar method like Marshal::StringToHGlobalAnsi() by using an
existing pointer, rather than allocating memory and returning a new pointer?
My target buffers are persistent must must not be allocated every time when
converting from String to char*;

Thanks,
Urs
 
J

Jochen Kalmbach [MVP]

Hi Urs!
Is there a similar method like Marshal::StringToHGlobalAnsi() by using an
existing pointer, rather than allocating memory and returning a new pointer?
My target buffers are persistent must must not be allocated every time when
converting from String to char*;

You can use "WideCharToMultiByte" in conjuction with "PtrToStringChars".

--
Greetings
Jochen

My blog about Win32 and .NET
http://blog.kalmbachnet.de/
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top