mqTrim
The mqTrim call trims the blanks from a blank-padded string, then terminates it with a null.
Syntax for mqTrim
- mqTrim (BufferLength, Buffer, String, CompCode, Reason)
Parameters for mqTrim
- BufferLength (MQLONG) - input
- Length in bytes of the buffer containing the string padded with blanks. Must be zero or greater.
- Buffer (MQCHAR × BufferLength) - input
- Buffer containing the blank-padded string. The length is given by the BufferLength parameter. If zero is specified for BufferLength, the null pointer can be specified for the address of the Buffer parameter; in all other cases, a valid (nonnull) address must be specified for the Buffer parameter.
- String (MQCHAR × (BufferLength +1)) - output
- Buffer to receive the null-terminated string. The length of this buffer must be at least one byte greater than the value of the BufferLength parameter.
- CompCode (MQLONG) - output
- Completion code.
- Reason (MQLONG) - output
- Reason code qualifying CompCode.
The following reason
codes indicating error conditions can be returned from the mqTrim call:
- MQRC_BUFFER_ERROR
- Buffer parameter not valid (invalid parameter address or buffer not completely accessible).
- MQRC_BUFFER_LENGTH_ERROR
- Buffer length not valid.
- MQRC_STRING_ERROR
- String parameter not valid (invalid parameter address or buffer not completely accessible).
Usage notes for mqTrim
- If the two buffer pointers are the same, the trimming is done in place. If they are not the same, the blank-padded string is copied into the null-terminated string buffer. After copying, the buffer is scanned backwards from the end until a nonspace character is found. The byte following the nonspace character is then overwritten with a null character.
- If String and Buffer partially overlap, the result is undefined.
C language invocation for mqTrim
mqTrim (BufferLength, Buffer, String, &CompCode, &Reason);Declare the parameters as follows:
MQLONG BufferLength; /* Buffer length */ PMQCHAR Buffer; /* Buffer containing blank-padded string */ MQCHAR String[n+1]; /* String with blanks discarded */ MQLONG CompCode; /* Completion code */ MQLONG Reason; /* Reason code qualifying CompCode */Note: This call is not supported in Visual Basic. Parent topic: MQAI calls