- 268 名前:デフォルトの名無しさん mailto:sage [2006/11/29(水) 17:35:27 ]
- >>254
#using <mscorlib.dll> #include <vcclr.h> #include <string> #include <iostream> int main() { using System::Runtime::InteropServices::Marshal; System::String^ s = L"HogeHoge"; pin_ptr<const wchar_t> pwc = PtrToStringChars(s); std::wstring wstr(pwc, static_cast<std::size_t>(s->Length)); System::IntPtr ptr = Marshal::StringToHGlobalAnsi(s); std::string str(static_cast<const char*>(ptr.ToPointer()), static_cast<std::size_t>(s->Length)); Marshal::FreeHGlobal(ptr); std::wcout << wstr << L'\t'; std::cout << str << std::endl; }
|

|