Intel® Fortran Compiler 18.0 Developer Guide and Reference
The B data edit descriptor transfers binary (base 2) values. It takes the following form:
Bw[.m]
The value of m (the minimum number of digits in the constant) must not exceed the value of w (the field width), unless w is zero. The m has no effect on input, only output.
The specified I/O list item can be of type integer, real, or logical.
On input, the B data edit descriptor transfers w characters from an external field and assigns their binary value to the corresponding I/O list item. The external field must contain only binary digits (0 or 1) or blanks. w must not be zero.
If the value exceeds the range of the corresponding input list item, an error occurs.
The following shows input using the B edit descriptor:
Format Input Value B4 1001 9 B1 1 1 B2 ^0 0 B6 ^^^122 An error; the 2 is invalid in binary notation
On output, the B data edit descriptor transfers the binary value of the corresponding I/O list item, right-justified, to an external field that is w characters long.
The field consists of zero or more blanks, followed by an unsigned integer constant (consisting of binary digits) with no leading zeros. A negative value is transferred in internal form.
If w is zero, the external field has the minimum number of characters necessary to represent the value. If both w and m are zero and the internal value is zero, the external field is one blank.
If m is specified, the unsigned integer constant must have at least m digits. If necessary, it is padded with leading zeros.
If m is zero, and the output list item has the value zero, the external field is filled with blanks.
The following shows output using the B edit descriptor (the symbol ^ represents a nonprinting blank character):
Format Value Output B4 9 1001 B2.2 1 01 B0 42 101010