Binary I/O
Binary, or unformatted, I/O involves characters, character arrays, or strings, which are read or written without interpretation, padding, or other adjustments. End-of-lines are not treated specially.
The unformatted read functions (such as get and read ) can read into a string or character array. The gcount function returns the number of
characters read.
The unformatted output functions (such as put and write ) can write a string or character array. You can specify
the exact number of characters to write from a character array or write
all characters up to a null character (to write a C-style
null-terminated string).
You can also dip down the stream buffer level to perform unformatted I/O, although this is seldom done except for bulk I/O of entire streams. See the next section for more information.
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access