开发者

How to change string of ^ type to char* type in vc++ CLR window application?

开发者 https://www.devze.com 2023-01-09 03:29 出处:网络
I\'m working on a vc++ CLR window 开发者_JAVA技巧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

I'm working on a vc++ CLR window 开发者_JAVA技巧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.


You probably want Marshal::StringToHGlobalAnsi

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

See msdn for more.

0

精彩评论

暂无评论...
验证码 换一张
取 消