B, I, O, and Z Format Codes
The B, I, O, and Z format codes are used to transfer integer values to and from the specified file. The B format code is used to output binary values, I is used for decimal values, O is used for octal values, and Z is used for hexadecimal values.
The syntax is:
where the parameters "n", "+", and "-" are as described in Syntax of Format Codes and the width specification is as follows:
| w |
is an optional width specification (0 ≤ w ≤ 255). The variable w specifies the number of digits to be transferred. See Padding and Natural Width Formatting for additional details on the output width of a formatted value. |
| m |
is an optional minimum number (1 ≤ m ≤ 255) of nonblank digits to be shown on output. The field is zero-filled on the left if necessary. If m is omitted or zero, the output is padded with blanks to achieve the specified width. Note - The m parameter is ignored if w is zero. |
Overflow
On output, if the field provided is not wide enough, it is filled with asterisks (*) to indicate the overflow condition.
Default Values of the w Parameter
The default values used by the I, O, and Z format codes if w is omitted are specified in the following table:
|
Data Type
|
w
|
|---|---|
| Byte, Int, UInt |
7 |
| Long, ULong, Float |
12 |
| Long64, ULong64 |
22 |
| Double |
23 |
| All Other Types |
12 |
The default values used by the B format code if w is omitted are specified in the following table:
|
Data Type
|
w
|
|---|---|
| Byte |
8 |
| Int, UInt |
16 |
| Long, ULong |
32 |
| Long64, ULong64 |
64 |
| All Other Types |
32 |
Format Code Examples
The following table shows the results of the application of various format codes to given data values. Note that normally, the case of the format code is ignored by IDL. However, the case of the Z format codes determines the case used to output the hexadecimal digits A-F.