From: Bobby Ward (bobbyrward_at_[hidden])
Date: 2006-07-18 14:46:22
I actually spent yesterday trying to figure out why my XML writing code was
all messed up.
Took me a while to figure that one out.
On 7/18/06, Philipp Henkel <threadpool_at_[hidden]> wrote:
> Dear all,
> I wondered about boost::format's printf behaviour regarding char's.
> There seems to be no difference between the two format pattern "%c" and
> "%d". boost::format does not interpret chars as decimal values when using
> Please take a look a the following example:
> unsigned char foo = 65;
> printf("foo = %d", foo); // output is "foo = 65"
> std::string bar = (boost::format("foo = %d\n") % foo).str();
> printf(bar.c_str()); // output is "foo = A" which is what I want when
> Is this behaviour intended? From my point of view it's dangerous because
> printf users
> do not expect it. Furthermore it may lead to string truncations because
> terminators (char is 0) which are inserted by accident.
> Did I overlook something?
> I'm using boost 1.33.1 / VC8.
> Best regards,
> Unsubscribe & other changes:
-- Bobby Ward ------------------------------ bobbyrward_at_[hidden] http://sf.net/projects/combustion
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk