jjzjj

encodedBytes

全部标签

.NET System::String 到存储在 char* 中的 UTF8 字节

我正在将一些非托管C++代码包装到.NET项目中。为此,我需要将System::String转换为存储在char*中的UTF8字节。我不确定这是否是最好的或什至是正确的方法,如果有人可以看一下并提供反馈,我将不胜感激。谢谢,/大卫//CopyintoblankVisualStudioC++/CLRcommandlinesolution.#include"stdafx.h"#includeusingnamespaceSystem;usingnamespaceSystem::Text;usingnamespaceSystem::Runtime::InteropServices;//Test