Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #using <System.dll> //.NETライブラリ
- #include <iostream> //標準入出力C++ライブラリ
- #include <string> //標準C++文字列ライブラリ
- using namespace System;
- using namespace System::Runtime::InteropServices;
- using namespace std;
- int main()
- {
- String^ text = gcnew String(L"文字列");
- IntPtr mptr = Marshal::StringToHGlobalAnsi(text);
- std::string result = static_cast<const char*>(mptr.ToPointer());
- Marshal::FreeHGlobal(mptr);
- cout << result << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement