Cipher
Cipher

Reputation: 352

Is there C# `Encoding.UTF8.GetString` equivalent in C++?

Is there C# Encoding.UTF8.GetString equivalent in C++ ? Or another fast way parse byte array containing the sequence of bytes and decode to string.

Upvotes: 2

Views: 1778

Answers (1)

Praveen Patel
Praveen Patel

Reputation: 519

You can try this:

auto *wstrBytes = new wchar_t[size];
memcpy_s(wstrBytes , size, rawBytes, size);
std::wstring unicodeStr(wstrBytes , size);
delete [] wstrBytes;

Upvotes: 1

Related Questions