Message file access: Writing message data

Write message data directly to open file handles. Similar to reading directly from files, this bypasses the normal Tcl interface and preserves null characters.

Similar to msgget, msgwrite defaults to the entire message contents, but offset and length values can be specified to limit the data written.

Through the msgwrite command, the same style choices are available as reading:

  • The nl style appends a newline character after the data.

    For example:

    Input: msgwrite nl message6 stdout
    Output: daemon 
  • The len10 style prepends a 10-character length-encoding string before the data.

    For example:

    nput: msgwrite len10 message6 stdout 2
    Output: 0000000004emon

    A prompt is given after the data because there is not a trailing newline character.

  • The raw style writes only the data.

    For example:

    Input: msgwrite raw message6 stdout 3 2
    Output: mo

    A prompt is given after the data because there is not a trailing newline character.