On 9 August 2012 23:27, Arthur Schwarz wrote: > Thanks. Is there any way to output a unsigned char/char value without casting it > to (int) (long ...)? > > One reason to do this is to preserve the size of the char. A byte is not defined > as 8-bits. 8-bits is defined as an octet. I have seen byte sizes of 6, 7, 8, 9, > 12, and 16 bits on various pieces of hardware and whether a wide-char is used. > Forcing the char to int changes the number of bits used. There are other ways of > treating the problem(s) but I wonder if there is a way to just output a char in > hex directly. Not using ostreams, no.