
How can I use cout <<... to perform the equivalent to printf( " %.2X ",buf[i] ); when buf[] was declared as uint8_t buf[] ; and the content of buf[i] are hex numbers like 0x5e, or 0xfd, etc ? I think that I would have to include #include <iomanip> ,but I am at a loss how to accomplish the formatting. John
#include<iomanip> cout.setf(std::ios::fixed | std::ios::hex); cout << std::setprecision(2) << buf[i]; at least that's off the top of my head... I think that's right... I'm sure that a quick google search will fill in the blanks if the above doesn't compile or do the right thing... -Jing -- The Toronto Linux Users Group. Meetings: http://tlug.ss.org TLUG requests: Linux topics, No HTML, wrap text below 80 columns How to UNSUBSCRIBE: http://tlug.ss.org/subscribe.shtml
participants (1)
-
jingsu-26n5VD7DAF2Tm46uYYfjYg@public.gmane.org