小编Igo*_*cki的帖子

如何在 std::wstringstream 中插入 NULL 字符?

我需要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 字符。

c++ std stringstream

6
推荐指数
1
解决办法
127
查看次数

标签 统计

c++ ×1

std ×1

stringstream ×1