I would comment on your overall strategy for accomplishing your goal (ie. it is definitely no the way I would go about it) but I will focus on an answer.
Firstly, you should use std::cin.width(10)
to limit the number of characters actually stored and moved to myID.
Secondly, you seem to have been lucky in the above case. The overflow bytes were written into the second array sendBuff
and sprintf was writing characters from both myID and sendBuff.
The reason the overflow bytes were written into the second array is that the compiler simply placed myID and sendBuff in memory regions that were contiguous. ie myID[1000] would be the same as sendBuff[1000-11]