In C+, AMX coding for example is the buffering or analyzing the string feedback from the device you are trying to control. You might only need parts of it so you can use as true feedback. A prime example is Aprilaire and Jandy products as the receive string is so long and all you want is the status along with current temp you to a variable text window created in touchpanel design. Takes counting charachters to display true feedback. Example Below:
You could maybe also take a look at AMXX's parse native? I think it does what you want, except obviously it's coded as a native right now... Looks kind of long, though.
PHP Code:
/* Gets parameters from text.
* Example: to split text: "^"This is^" the best year",
* call function like this: parse(text,arg1,len1,arg2,len2,arg3,len3,arg4,len4)
* and you will get: "This is", "the", "best", "year"
* Function returns number of parsed parameters. */ native parse(const text[], ... );
static cell AMX_NATIVE_CALL parse(AMX *amx, cell *params) /* 3 param */ {
int inum = *params / sizeof(cell), iarg = 2, c;
char* arg, *parse = get_amxstring(amx, params[1], 0, c);
cell *cptr;
int state;
while (*parse)
{
arg = parse_arg(&parse,state);
if (state)
{
if (inum <= iarg)
return ((iarg - 2)>>1);
cptr = get_amxaddr(amx, params[iarg++]);
c = *get_amxaddr(amx, params[iarg++]);
while (c-- && *arg)
*cptr++ = (cell)*arg++;
*cptr = 0;
}
}
return ((iarg - 2)>>1);
}