le Thursday 24 February 2005 13:21,
NO**********************************@vecerina.com écrivit :
"Mastupristi" <cialdi_NO_SP@AM_gmail.com> wrote in message
news:20050224112636.000010aa.cialdi_NO_SP@AM_gmail .com... On 24 Feb 2005 01:15:20 -0800
"Dietmar Kuehl" <di***********@yahoo.com> wrote:
std::cout << std::hex << std::showbase << std::uppercase
<< std::internal << std::setw(8) << std::setfill('0')
<< 0x015b << "\n";
ok, now I obtain "0X015B" instead of "0x015B".
How can be improved this print?
I guess you could try:
std::cout << "0x" << std::hex << std::uppercase
<< std::internal << std::setw(8) << std::setfill('0')
<< 0x015b << "\n";
Now if you ask me, I wouldn't bother wrestling with the
standard C++ streams formatting. I'd go for boost::format
or some other kind of wrapper around the C library calls...
boost::format is not a wrapper around C lib calls, it's a wrapper around
stream calls.. so it'll actually do the same thing as the above lines.
(but it would be possible to overload boost::format for basic types and
forward those to a suitable function of the printf family. It might help
performance.. and ease compatibility with printf for basic types :) I
should try that when I have some time.)
--
Samuel.Krempp
cout << "@" << "crans." << (is_spam ? "trucs.en.trop." : "" )
<< "ens-cachan.fr" << endl;