Re: Display a 32bit value as a 4ch string?



Igor Tandetnik wrote:

wcout << (char)((dwFCC >> 24) & 0xFF) << (char)((dwFCC >> 16) & 0xFF)
<< (char)((dwFCC >> 8) & 0xFF) << (char)(dwFCC & 0xFF);

Thanks, this works.

I understand the bit shifting and char cast, but I don't understand the bitwise & with 0xFF. I'm guessing it's something to do with signed/unsigned?

--
Gerry Hickman (London UK)
.



Relevant Pages

  • Re: Display a 32bit value as a 4ch string?
    ... I understand the bit shifting and char cast, but I don't understand the bitwise & with 0xFF. ... I'm guessing it's something to do with signed/unsigned? ... In each case the "& 0xFF" picks off the least significant byte (unsigned char, ...
    (microsoft.public.vc.language)
  • program logic based on endianness
    ... The logic of shifting and action based on the result, ... assumes that the system is big-endian. ... I wanted to know if the above holds true for bitwise and and ... operation a&b or a|b irrespective of the endianness of the system. ...
    (comp.unix.programmer)
  • Re: program logic based on endianness
    ... The logic of shifting and action based on the result, ... assumes that the system is big-endian. ... I wanted to know if the above holds true for bitwise and and ... the bitwise operators -- work on the values of their ...
    (comp.unix.programmer)
  • Re: Unicode chinese
    ... bitwise and bit shifting? ... Roedy Green Canadian Mind Products ...
    (comp.lang.java.programmer)
  • Re: Bit shifting question
    ... I read "does not have Java's bit shifting" as "does ... not have bitwise operators". ... Chris Smith - Lead Software Developer/Technical Trainer ...
    (comp.lang.java.help)

Loading