TipcMsgGetCurrent get the current field of a message
msg
message to get current field from
field_num_return
storage for message field number
TRUE
if the current field was successfully retrieved from the message, FALSE
otherwise.
If TipcMsgGetCurrent fails, it returns FALSE
and sets the global SmartSockets error number to one of:
TipcMsgGetCurrent gets the current field of a message as a field number between 0 and the number of fields in the message minus one.
If TipcMsgGetCurrent returns FALSE
, it does not store a value in field_num_return
.
TipcMsgGetNumFields, TipcMsgSetCurrent
This example creates a message, appends fields, gets the current field, reads the fields, and gets the current field:
T_IPC_MT mt; T_IPC_MSG msg; T_STR str; T_REAL8 real8; T_INT4 field_num; mt = TipcMtLookupByNum(T_MT_NUMERIC_DATA); if (mt == NULL) {return
; /* error */
} msg = TipcMsgCreate(mt); if (msg == NULL) {return
; /* error */
} if (!TipcMsgAppendStrReal8(msg, "speed_limit", 65.0)) {return
; /* error */
} if (!TipcMsgGetCurrent(msg, &field_num)) {return
; /* error */
} TutOut("current field is %d\n", field_num); if (!TipcMsgNextStr(msg, &str)) {return
; /* error */
} TutOut("str = %s\n", str); if (!TipcMsgGetCurrent(msg, &field_num)) {return
; /* error */
} TutOut("current field is %d\n", field_num); if (!TipcMsgNextReal8(msg, &real8)) {return
; /* error */
} TutOut("real8 = %s\n", TutRealToStr(real8)); if (!TipcMsgGetCurrent(msg, &field_num)) {return
; /* error */
} TutOut("current field is %d\n", field_num);
TIBCO SmartSockets™ Application Programming Interface Software Release 6.8, July 2006 Copyright © TIBCO Software Inc. All rights reserved www.tibco.com |