Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

stream modifiers

17 views
Skip to first unread message

ruben safir

unread,
Dec 4, 2016, 5:19:17 AM12/4/16
to
can on make std::cout format a uinit_8 as an integer type of 8 bits - or
just print a number at least.

Bo Persson

unread,
Dec 4, 2016, 5:38:39 AM12/4/16
to
On 2016-12-04 11:19, ruben safir wrote:
> can on make std::cout format a uinit_8 as an integer type of 8 bits - or
> just print a number at least.
>

The problem is that the 8-bit type is just a typedef for unsigned char.
So the I/O treats it like a character. Because it is.

To display it as an integer, you will have to cast it to unsigned int.


Bo Persson

Alf P. Steinbach

unread,
Dec 4, 2016, 6:33:54 AM12/4/16
to
On 04.12.2016 11:19, ruben safir wrote:
> can on make std::cout format a uinit_8 as an integer type of 8 bits - or
> just print a number at least.

The shortest way is to add a `+` in front of it.

- Alf


0 new messages