-3

Try as I might, I cannot find any information on what cin.binary is for.

similar ones, thinking bases, dec, hex, octal only seem to appear when used with cout - e.g.,

cout << std::hex << n;.

However cout << std::binary << n; isn't valid

Entering cin. produces this intellisense popup

intellisense popup for <code>cin.</code>

I'm left assuming that these are some sort of flags. Sure would be nice to know for sure though.

peedurrr
  • 187
  • 16

2 Answers2

1

binary is a flag to tell the stream to be opened in binary mode (instead of textual mode).

You can find documentation on these flags here: http://en.cppreference.com/w/cpp/io/ios_base/openmode

You might also search on this site for other flags and functions of std::basic_istream(e.g. std::cin): http://en.cppreference.com/w/cpp/io/basic_istream

Simon Kraemer
  • 5,700
  • 1
  • 19
  • 49
0

Reference: std::ios_base::openmode

binary is used to open a istream in binary mode (as opposed to text mode).

std::cin is not open in binary mode, please read the answers here for more details.

Community
  • 1
  • 1
roalz
  • 2,699
  • 3
  • 25
  • 42