【发布时间】:2016-03-10 21:25:50
【问题描述】:
我需要在低级别处理存储在宽字符串中的数据。我可以使用以下方法转换为Bytes 的vector:
typedef unsigned char Byte;
wstring mystring = L"my wide string";
Byte const *pointer = reinterpret_cast<Byte const*>(&mystring[0]);
size_t size = mystring.size() * sizeof(mystring.front());
vector<Byte> byteVector(pointer, pointer + size);
但是,我在走另一条路时遇到了麻烦;我对选角不是很熟悉。如何将Bytes 的vector 转换为wstring?
【问题讨论】:
标签: c++ vector byte bytearray widestring