Manipulating character strings in C++

Character data is often returned in ImqString class objects which can be cast to char * using a conversion operator. The ImqString class contains methods to assist in the processing of character strings.

When character data is accepted or returned using MQI C++ methods, the character data is always null-terminated and can be of any length. However, certain limits are imposed by IBM MQ that might result in information being truncated. To ease storage management, character data is often returned in ImqString class objects. These objects can be cast to char * using the conversion operator provided, and used for read-only purposes in many situations where a char * is required.

Note: The char * conversion result from an ImqString class object might be null.

Although C functions can be used on the char *, there are special methods of the ImqString class that are preferable; operator length ( ) is the equivalent of strlen and storage ( ) indicates the memory allocated for the character data.

Parent topic: C++ language considerations