char c = '\xab';
cout << hex << static_cast<unsigned>(static_cast<unsigned char>(c));
バイナリデータはunsigned charで扱う癖をつけておいたほうがいいと思う。