I have am array of chars that I'm using for bytecode. Printing them out one by one should yield the same hex values that you see here:
char toWrite[] = {'\x50','\x48','\xB8','\x00','\x00','\x00','\x00','\x00','\x00','\x00','\x00','\xFF','\xE0' };
When I try to print these values out in a loop, however, they are mangled. What I see instead is:
50 48 ffffffb8 00 00 00 00 00 00 00 ffffffff ffffffe0
Why are these chars printing wrong? I am iterating in a foreach loop, and every single element is passed to
cout << hex << (int)currentChar << endl;
(int)(unsigned char)currentChar