Formatting in C++

Peter L. Peres plp-ysDPMY98cNQDDBjDh4tngg at
Fri Dec 26 10:30:52 UTC 2003

On Thu, 25 Dec 2003, John Wildberger wrote:

> 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.

cout << uint8 << buf[i]; // example only, uint8 may not work on your c++

Look up the correct syntax for the uint8 there are a dozen options.

The Toronto Linux Users Group.      Meetings:
TLUG requests: Linux topics, No HTML, wrap text below 80 columns

More information about the Legacy mailing list