C++ newbie here.
I have 3 strings
const char section1[] = {0x12, 0x34, 0x56, 0x78};
std::wstring section2 = L"section2";
const char section3[] = {0x23, 0x45, 0x67, 0x89};
And I need to join them together with a result that looks like
{0x12, 0x34, 0x56, 0x78, 0x73, 0x00, 0x65, 0x00, 0x63, 0x00, 0x74, 0x00, 0x69, 0x00, 0x6f 0x6e, 0x00, 0x32, 0x00, 0x23, 0x45, 0x67, 0x89}
So two ASCII bits with a Unicode section sandwiched in the middle.
What’s the best way to join them and what’s the best data type to store for outputting to file?
You can also use memcpy for section 1 and 3, and if you make assumptions about endianness for section2 as well. The above loops should be easy to read and understand though.
When done, you simply write Buffer.size() bytes starting from &Buffer[0]