tags:

views:

16

answers:

1

Hi all, I'm working on a vc++ CLR window application.In this application when I browse the local file system for file selection, the input file path is coming in string^ type ...now I want to change this ^ type to char* type. Help me. Thank you.

A: 

You probably want Marshal::StringToHGlobalAnsi

IntPtr p = Marshal::StringToHGlobalAnsi(managedString);
char* c = (char*)p.ToPointer();
...
Marshal::FreeHGlobal(p);

See msdn for more.

ngoozeff