Boost logo

Boost Users :

Subject: Re: [Boost-users] boost::format, print hex
From: Lloyd (lloyd_at_[hidden])
Date: 2010-07-09 10:57:24

Thansk Igor, it works in that case. But it is not working in this case...

 char a[10];
 stringstream ss;

It prints FFFFFFFA

Thanks a lot,

----- Original Message -----
From: "Igor R" <boost.lists_at_[hidden]>
To: <boost-users_at_[hidden]>
Sent: Friday, July 09, 2010 7:59 PM
Subject: Re: [Boost-users] boost::format, print hex

>> With the following program I am trying to print the hex of "a". But it is
>> not printing it correctly. I have gone through the boost format sysntax
>> specification. But I dont have any clue, what am I doing wrong?
>> char a=0x11;
>> stringstream ss;
>> ss<<boost::format("%|02X|")%a;
>> cout<<ss.str()<<endl;
> Assuming your format string is correct (I haven't checked against the
> doc), try casting your char to int: (int)a
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]

Scanned and protected by Email scanner

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at