Modifying data with msgset

You can modify data with msgset using these methods:

  • msgset is the most general way to modify message data. Its offset and length parameters specify the region of the message to replace with new data. If neither is specified, then the entire message is replaced with the new data.

    For example:

    nput: msgset message6 "This is message6's new\ value"
    
    Input: msgget message6
    Output: This is message6's new VALUE
  • Replacing a 0-length region is an insertion. If the offset is at or beyond the message's length, then it is an append.

    For example:

    Input: msgset message6 "string " 5 0
    
    Input: msgget message6
    Output: This string is message6's new value
  • msgset can replace some portion of the message data with a new string. If the new and old strings have different lengths, then msgset

    For example: adjusts the message length.

    Input: msgset message6 "These characters are" 2 12
    
    Input: msgget message6
    Output: These characters are message6's new value
  • Replacing a region with an empty string removes that region.

    adjusts the messageFor example:

    Input: msgset message6 {} 31 4
    
    Input: msgget message6
    Output: These characters are message6's value
  • msgset processes the -cvtnull option in the appropriate manner.

    For example:

    Input: msgset -cvtnull - message6 "Some-data"
    
    Input: msglength message6
    Output: 9
    
    Input: msgget message6
    Output: some
    
    Input: msgget -cvtnull Z message6
    Output: someZdata