close

System::String 和 std::string

1.std::string to System::String^
 
//將 std::string 轉 System::String^,os 是 std::string
String^ str = gcnew String(os.c_str());

2.System::String 轉 std::string               comboBox是System::String!!!!
const char* chars = (const char*)(System::Runtime::InteropServices::Marshal::StringToHGlobalAnsi(source)).ToPointer();
string dest = chars;

c++ clr寫法

saveFilePath = (string*)Marshal::StringToHGlobalAnsi(folderBrowserDialog1->SelectedPath).ToPointer();

arrow
arrow
    文章標籤
    System::String std::string
    全站熱搜

    興趣使然的開箱 發表在 痞客邦 留言(0) 人氣()