Reputation: 21
For example :
char str[] = {0x1B, 0x54, 0x32, 0xFE, 0x88, 0x10, 0x34, 0x6F, 0x54};
But this is C style. So how can i do same with std::string
and without using C functions?
Upvotes: 1
Views: 19328
Reputation: 48605
You can do this:
std::string s = "\x1B\x54\x32\xFE\x88\x10\x34\x6F\x54";
Upvotes: 2
Reputation: 27365
So how can i do same with std::string and without using C functions?
try this:
std::string str{0x1B, 0x54, 0x32, 0xFE, 0x88, 0x10, 0x34, 0x6F, 0x54};
or this:
using namespace std::literals::string_literals;
auto str = "\x1B5432FE8810346F54"s;
or this:
std::string str = "\x1B5432FE8810346F54";
Upvotes: 9