掲示板システム
ホーム
アクセス解析
カテゴリ
ログアウト
String^ からchar*に変換するには? (ID:70006)
名前
ホームページ(ブログ、Twitterなど)のURL (省略可)
本文
↑再現できません。 以下のコードをコマンドラインでコンパイル/実行できました。 // foo.cpp // compile: cl -clr foo.cpp #include <msclr/marshal.h> // char*, wchar_t* #include <msclr/marshal_windows.h> // BSTR #include <msclr/marshal_cppstd.h> // std::string, std::wstring #include <iostream> using namespace System; using namespace std; int main() { String^ s = L"alphabetやカタカナ漢字を含む文字列"; msclr::interop::marshal_context ctx; const char* s2 = ctx.marshal_as<const char*>(s); cout << s2 << endl; }
←解決時は質問者本人がここをチェックしてください。
戻る
掲示板システム
Copyright 2020 Takeshi Okamoto All Rights Reserved.