我需要REG_MULTI_SZ在 C++ 中从 .a 表示的值列表构造一个多字符串 () std::vector<std::wstring>。
这是首先想到的,但当然是错误的:
std::wstring GetMultiString(std::vector<std::wstring> Values)
{
std::wstringstream ss;
for (const std::wstring& Value : Values) {
ss << Value;
ss << L"\0";
}
ss << L"\0";
return ss.str();
}
Run Code Online (Sandbox Code Playgroud)
经检查,返回的字符串没有任何嵌入的 NULL 字符。