msgread

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?

This command reads the next message from fileId, an open file handle. It then replaces a part of msgId with the data read.

The replacement region begins at offset off, 0 if not specified. It includes len bytes. These are the remainder of the message data, if not specified.

  • If a len10 or nl read is specified, then the appropriate message boundary is used to terminate the read.
  • Supply a read length, len, for raw reads.

If a statsVar variable name is supplied, then the variable is set to contain a list of two values: todo done

  • todo is the number of bytes 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 can be useful when a read fails.

This command returns the number of bytes read.