In the first place, are you sure you want to use a double? A double is not a traditional binary value, but a floating point representation. If you set the value of a double to 1, the binary pattern will not be ....00000000000001. If it's an integer, on the other hand, and you know the value is not going to exceed 127 or 255 (I'm presuming you're dealing with ASCII/ANSI from the 'SOH' usage), then you can simply cast the int to a char (you may get a warning about possible loss of information) and stash it in the last byte of the string. Since a string is represented by a class, it's size is dynamically controlled. You would need to initialize the string to 8 zeroes, then stash the char using the [] operator. Bear in mind that construction of a string from characters is different from constructing a string from a C string (char array). Consequently, if you're initializing with the char '\0', bear that in mind.

If you have something else in mind, try to be clearer. If you don't understand my comment regarding the binary value of a double, then you need to do some investigation. You might start with IEEE 754, although not all implementations conform strictly to that standard.