syntax - Is it possible to define a CAPL function returning a text string? -
i develop capl scripts in vector canoe, , need define several functions returning text strings. in c, write this:
char * errorcodetomsg(int code) or
char [] errorcodetomsg(int code) in capl, both definitions fail parse error. working solution came far is:
variables { char retval[256]; } void errorcodetomsg(int code) { char [] msg = "hello word"; strncpy(retval, msg, 256); } of course ugly, because each call errorcodetomsg requires 2 statements instead of one. there better way?
you have string-based functions :
void errorcodetomsg(char buffer[], int code){ buffer = mylistofcodes[code]; } the value stored in buffer using reference value. not possible return string in capl. why can't access string system variables using @ selector.
Comments
Post a Comment