| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
If iport is a file port, the behavior of read-block
differs by the buffering mode of the port (See section 6.18.3 File ports, for
the detail explanation of buffering modes).
:full, read-block waits
until nbytes data is read, except it reads EOF.
:modest or :none, read-block
returns shorter string than nbytes even if it doesn't reach EOF,
but the entire data is not available immediately.
Read-block returns newly allocated string every time.
If you want to avoid allocation and read the data into a pre-allocated
fixed-length buffer, you can use read-block!
in gauche.uvector module (See section 9.24.4 Uvector block I/O).
It uses a uniform vector as the buffer.
If you want to write a chunk of bytes to a port,
you can use either display if the data is in string,
or write-block in gauche.uvector (See section 9.24.4 Uvector block I/O)
if the data is in uniform vector.
#t.
For now, this procedure actually checks only if next byte is
immediately available from port. If the next byte is a part of
a multibyte character, the attempt to read the whole character may block,
even if char-ready? returns #t on the port.
(It is unlikely to happen in usual situation, but theoretically it can.
If you concern, use read-block to read the input as a byte
sequence, then use input string port to read characters.)
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |