int a = 339;
char b = a;
char c = (char)a;
int d = (int)b;
int e = a & 0xff;
cout << a << " " << b << " " << c << " " << d << " " << e << std::endl;
from the output we can see that the way that casting (char)num works is the same way as logicaly AND the int with only the first 8 bits.
what I dont understand in your code is m_pRes and itoa, what you need em for? just use casting