|
Boost Users : |
Subject: Re: [Boost-users] boost::format, print hex
From: Eric J. Holtman (eric_at_[hidden])
Date: 2010-07-09 11:02:05
change to "unsigned char".
You're getting bitten by sign extension.
On 7/9/2010 9:57 AM, Lloyd wrote:
> Thansk Igor, it works in that case. But it is not working in this case...
>
> char a[10];
> a[0]=0xFA;
> stringstream ss;
> ss<<boost::format("%|02X|")%(int)(a[0]);
> cout<<ss.str()<<endl;
>
> It prints FFFFFFFA
>
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net