So, I have a hex file that I read into a vector. and now I'm printing out it's contents by doing a good ol' printf. When it does this I am surprised to see vaules that were FF in my hex editor come up as FFFFFF80, FFFFFFFF, FFFFFF98 and other things like that. I assumed that maybe the hex editor, when it displayed them, just left off the end to these numbers, so I did a printf("%.2X",hexnumber); and that gave me the same result. Why is this happening and why are the FF's in my editor being displayed as something else in the program?
that is of course correct, but if you try to printf an integer, the result may vary depending on the value input. I. e. a negative integer or a byte value with the MSB set may be prepended by 0xFF
Bookmarks