msgread

This reads the next message from fileId, an open file handle, and replaces some part of msgId with the data read.

msgread ?-stats statsVar? len10 msgId fileId ?off? ?len?
msgread ?-stats statsVar? nl msgId fileId ?off? ?len?
msgread ?-stats statsVar? raw msgId fileId len ?off? ?len?

The replacement region begins at offset off, or 0, if not specified. It includes len bytes, or the remainder of the message data, if not specified. If you specify a len10 or nl read, then use the appropriate message boundary to terminate the read.

Supply a read length, len, for raw reads.

If you supply a statsVar variable name, then the variable is set to contain a list of two values:

todo done
  • todo is the number of bytes that are requested. This is the length implied by a len10 record header; 0 for nl reads, or the len value for raw reads.
  • done is the actual number of characters read. These values are useful when a read fails.

This command returns the number of bytes read.