C++知识点

来源:互联网 发布:华为手机免费网络硬盘 编辑:程序博客网 时间:2024/06/06 00:02
  1. #include <comdef.h>   
  2. //system::String^ 转化为std::string
  3. std::string Convert2String(System::String^ str)  
  4. {  
  5.     int temp1 = (int)System::Runtime::InteropServices::Marshal::StringToHGlobalAnsi(str);  
  6.     char* temp2 = (char*)temp1;  
  7.     return std::string(p);//char* 2 string  
  8. }  
1 0
原创粉丝点击