Code:
std::string dns = "111001000000";
dns.c_str(); // Returns a (const?) char* to the string in the object
You want something like this, I suppose? If you're in a situation where you have to use a union and struct to send and receive this header without conversion errors, then you may be better off using an array. I'm not sure a string object directly reflects the size of the string it holds. I wouldn't quote me on that, though. It can be tricky introducing C++ into network libraries that are written for C.