System::Stringをstd::stringに変換する場合にMarshal::StringToHGlobalAnsiに ANSI (1 バイト) 文字として Unicode 文字列をアンマネージ メモリにコピーする際に未定義の値となりコピーができなく困っております。
どなたかお力を貸していただけますでしょうか。
C++
1// System::String を標準文字列に変換 2 static std::string systemStringToStdString(System::String ^ s) { 3 using namespace System::Runtime::InteropServices; 4 5 IntPtr hString = Marshal::StringToHGlobalAnsi(s); 6 std::string rtnSts = (const char *)hString.ToPointer(); 7 Marshal::FreeHGlobal(hString); 8 return rtnSts; 9 } 10
回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2017/09/05 04:40