char* ptr = (char*) Marshal::StringToHGlobalAnsi(str).ToPointer();
Marshal::FreeHGlobal(IntPtr(ptr));