I’m reading a book about C++. The author shows this enum:
[Flags] enum class FlagBits{ Ready = 1, ReadMode = 2, WriteMode = 4,
EOF = 8, Disabled = 16};
FlagBits status = FlagBits::Ready | FlagBits::ReadMode | FlagBits::EOF;
and he says that status is equals to ‘0000 0000 0000 0000 0000 0000 0000 1011’, but when I write status to console:
Console::WriteLine(L”Current status: {0}”, status);
it shows: ‘Current status: Ready, ReadMode, EOF’. How can he know it, and how can I write status to console to show its binary form?
You should look into System::Convert::ToString
Output: Current Status: 1011
Edit: if you want the empty zero ‘padding’ just do:
If you want it segmented into byte size pieces, then just split up the result and insert space / hyphens.