Dear All,
I have a question about how to access the string array data of waveform record in the callback function.
In order to read a waveform record, I register a callback function using the ca_create_subscription function.
static void eventCallback(struct event_handler_args eha) {
chid chid = eha.chid;
if (eha.status != ECA_NORMAL) {
printChidInfo(chid, "eventCallback");
}
else {
char *pdata = (char *)eha.dbr;
printf("Event Callback: %s = %s\n",ca_name(eha.chid),pdata);
}
}
SEVCHK(ca_create_subscription(DBR_STRING, 1, pvlist[i]->mychid, DBE_VALUE, eventCallback, pvlist[i], &pvlist[i]->myevid), "ca_create_subscription");
But, print the ascii character code of the first element of the string array.
How to access the string array data ?
When I use caget command line tool, the following message appears.
caget Test
Test 100 69 80 73 67 83 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
When the eventCallback function is called, the following message appears.
Event Callback: Test = 69
Best regards,