Next: , Previous: , Up: Design Choices and Extensions   [Contents][Index]


2.12 Stream Extensions

Function: sys:read-n-bytes stream buffer start numbytes &optional eof-error-p

On streams that support it, this function reads multiple bytes of data into a buffer. The buffer must be a simple-string or (simple-array (unsigned-byte 8) (*)). The argument nbytes specifies the desired number of bytes, and the return value is the number of bytes actually read.

  • If eof-error-p is true, an end-of-file condition is signalled if end-of-file is encountered before count bytes have been read.
  • If eof-error-p is false, read-n-bytes reads as much data is currently available (up to count bytes.) On pipes or similar devices, this function returns as soon as any data is available, even if the amount read is less than count and eof has not been hit. See also make-fd-stream.