|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
How to read "Message Identifier Bytes" in C code? |
« View previous topic :: View next topic » |
Author |
Message
|
gbaddeley |
Posted: Sun Nov 06, 2011 2:59 pm Post subject: |
|
|
 Jedi Knight
Joined: 25 Mar 2003 Posts: 2538 Location: Melbourne, Australia
|
rekarm01 wrote: |
gbaddeley wrote: |
The sprintf needs format specification "%02X" to print 2 hex bytes per array entry. |
"%.2X" will probably work better. |
I haven't tried "%.2X" but "%02X" works perfectly for me on Windows, z/OS and a range of UNIX platforms and compilers. _________________ Glenn |
|
Back to top |
|
 |
rekarm01 |
Posted: Mon Nov 07, 2011 1:49 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 1415
|
gbaddeley wrote: |
I haven't tried "%.2X" but "%02X" works perfectly for me on Windows, z/OS and a range of UNIX platforms and compilers. |
Hmm ... so it does. For "%X", either specification will work just as well:- "%02X" prints a minimum of two characters, padding with leading zeroes as needed.
- "%.2X" prints a minimum of two digits, padding with leading zeroes as needed.
- For "%X", there is no sign character, decimal point, or fractional part, so the number of characters is the same as the number of digits.
But this only takes care of adding a leading zero to single-digit hexadecimal values. In order to get rid of the extraneous "FFFFFF" characters ...
mvic wrote: |
unsigned char is probably needed |
|
|
Back to top |
|
 |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|
|