13.5. Unformatted I/O Using read, write and gcount
Unformatted input/output is performed using the read and write member functions of
ostream, respectively. Member function
read inputs bytes to a built-in array of
chars in memory; member function
write outputs bytes from a built-in array of
chars. These bytes are not formatted in any way. They’re input or output as raw bytes. For example, the call
char buffer = "HAPPY BIRTHDAY";cout.write( buffer, 10 );
outputs the first 10 bytes of
buffer (including null characters, if any, that would cause output with
<< to terminate). The call
cout.write( "ABCDEFGHIJKLMNOPQRSTUVWXYZ", 10 );
displays the first 10 characters of the alphabet.
read member function inputs a designated ...