Page 1 of 1

toString convert int to hex.

Posted: Wed Mar 31, 2010 11:40 am
by Akari
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.

Re: toString convert int to hex.

Posted: Wed Mar 31, 2010 9:27 pm
by nbeato
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);

Re: toString convert int to hex.

Posted: Thu Apr 01, 2010 10:18 am
by Akari

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);