toString convert int to hex.

What it says on the tin: a place to discuss proposed new features.
Post Reply
Akari
Gnoblar
Posts: 6
Joined: Wed Mar 12, 2008 10:56 am

toString convert int to hex.

Post by Akari » Wed Mar 31, 2010 11:40 am

As I see it's not possible because you can onpy pass one flag to setf function. If you can add mask to it - then it will become possible.
0 x

nbeato
Gnome
Posts: 372
Joined: Thu Dec 20, 2007 1:00 am
Location: Florida
x 1
Contact:

Re: toString convert int to hex.

Post by nbeato » Wed Mar 31, 2010 9:27 pm

The flags argument is a mask. Use a bitwise or with std::ios::hex.

Code: Select all

Ogre::String hex = Ogre::StringConverter::toString(140, 0, ' ', std::ios::hex | otherflags);
0 x

Akari
Gnoblar
Posts: 6
Joined: Wed Mar 12, 2008 10:56 am

Re: toString convert int to hex.

Post by Akari » Thu Apr 01, 2010 10:18 am

Code: Select all

Ogre::String hex = Ogre::StringConverter::toString(140, 0, ' ', std::ios::hex);
This don't do anything. Inner realization uses setf() with one argument which is add flags to exist flags, but don't remove others.

To set string to hex you need to write this

Code: Select all

stream.setf(std::ios::hex, std::ios::basefield);
0 x

Post Reply