fork download
  1. std::string MarshalString(System::String ^str){
  2. if(str == nullptr || str->Length == 0) return std::string("");
  3. using namespace System::Runtime::InteropServices;
  4. array<unsigned char>^ encodedBytes = System::Text::Encoding::UTF8->GetBytes(str);
  5. pin_ptr<unsigned char> pinnedBytes = &encodedBytes[0];
  6. return std::string(reinterpret_cast<const char*>(pinnedBytes));
  7. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:1: error: 'string' in namespace 'std' does not name a type
stdout
Standard output is empty