2009-05-19 142 views
-1

我看到another post该建议如下:如何将System :: String转换为unsigned char *?

String^ clistr = gcnew String("sample"); 
IntPtr p = Marshal::StringToHGlobalAnsi(clistr); 
char *pNewCharStr = static_cast<char*>(p.ToPointer()); 
Marshal::FreeHGlobal(p); 

我只是想检查,看看是否有任何其他的,偏爱的方式,或者如果有什么是错的上面?

回答

相关问题