Manipulating binary strings
Strings of binary data are declared as one of the MQBYTEn data types. Whenever you copy, compare, or set fields of this type, use the C functions memcpy, memcmp, or memset:
#include <string.h> #include "cmqc.h" MQMD MyMsgDesc; memcpy(MyMsgDesc.MsgId, /* set "MsgId" field to nulls */ MQMI_NONE, /* ...using named constant */ sizeof(MyMsgDesc.MsgId)); memset(MyMsgDesc.CorrelId, /* set "CorrelId" field to nulls */ 0x00, /* ...using a different method */ sizeof(MQBYTE24));Do not use the string functions strcpy, strcmp, strncpy, or strncmp because these do not work correctly with data declared as MQBYTE24.
Parent topic:
Coding in C
fg11680_