Right, so I'm playing around with memory moving data around. I'm having trouble here. What can I be doing wrong? I've accounted for the null terminator and it still doesn't output what I expect.
char buff[34] = "I will not do anything like that.";
char * protocol = "abcdefghi";
char data[44];
memcpy(data, protocol, 10);
memcpy(data + 9, buff, 34);
cout << data << endl; //abcdefghiI will not do anything like that.
cout << strlen(data) << endl; // 42
char poin[10];
memcpy(poin, data, 10);
cout << poin << endl; //abcdefghiI╠╠╠╠╠╠╠╠╠╠abcdefghiI will not do anything like that.
For the last cout I was expecting just abcdefghi, but it comes out as you see above. Any help is appreciated, thanks!