当使用C++/CLI包装C++本地代码时,常常需要将System::String转换为std::string或者char*以调用native C++函数。.net环境中的字符串是unicode的,占2个字节,而很多native C++函数都没有考虑unicode,这种转换不仅仅是2字节转1字节,同时也涉及到字符集的转换。当使用C++/CLI包装C++本地代码时,常常需要将System::String转换为std:
当使用C++/CLI包装C++本地代码时,常常需要将System::String转换为std::string或者char*以调用native C++函数。.net环境中的字符串是unicode的,占2个字节,而很多native C++函数都没有考虑unicode,这种转换不仅仅是2字节转1字节,同时也涉及到字符集的转换。当使用C++/CLI包装C++本地代码时,常常需要将System::String转换为std: