On 07/11/2014 10:56 PM, Sean Campbell wrote:
> How Can I Print Raw Binary Into The Console?
Taking a step back, a D program prints to stdout, not console. However,
in most cases a D program's output ends up on the console when it is
started in a console.
So, one can print any byte value to the stdout, which usually ends up on
the console. Now, the question is how that value will be interpreted by
the console. On some consoles (e.g. Linux) the byte stream is
interpreted as a UTF-8 stream or a control character in the case of 0b011.
> I Have Variable Of Type ubyte which equals 0b011 How Can I Get The
> Variable To Print Out As 011
That is different though. You seem to want to print the value 0b011 as
the string "011". %b format specifier does that. However, in most cases
it is also useful to zero-pad the output:
writefln("%08b", 0b011);
Ali