HighTechTalks DotNet Forums  

string to char[]

Dotnet Framework (Interop) microsoft.public.dotnet.framework.interop


Discuss string to char[] in the Dotnet Framework (Interop) forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
Pascal Cloup
 
Posts: n/a

Default string to char[] - 09-07-2007 , 05:19 AM






Hello,

What is the siplest way to convert a System::String to un unmanaged array of
ASCII char[]?

thanks in advance

Pascal



Reply With Quote
  #2  
Old   
Doug Semler
 
Posts: n/a

Default Re: string to char[] - 09-07-2007 , 11:25 AM






On Sep 7, 5:19 am, "Pascal Cloup" <pascal-cl... (AT) biogesta (DOT) fr> wrote:
Quote:
Hello,

What is the siplest way to convert a System::String to un unmanaged array of
ASCII char[]?

thanks in advance

Pascal
IntPtr p = Marshal.StringToHGlobal{Ansi|Auto|Uni}(s);

Use the one appropriate for your needs.

Don't forget to Marshal.FreeHGlobal(p) when done.



Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.