Well, it will depend a bit on your payload, and what all the possible formats for it are, and what types of data you want to extract.
If the payload always ends with a space followed by the number you want, and nothing more, you could use strrchr to find the last space in the string (the extra r tells it to start at the end and work backward). Then, once you find the last space, use strtol starting at the next char. E.g.:
Code:
p = strrchr(payload, ' ');
if (p)
interval = strtol(p+1, NULL, 10);
Alternatively, you can use strpbrk and pass it all the digit characters, to find the first digit in your payload, and use strtol on that.
Alternatively, you can use strtok to split up your payload in some sensible manner (split on spaces?), and use the right part of the string that way.
Alternatively, you could use sscanf to scan the payload for your data, something like
Code:
if (sscanf(payload, "INTERVAL %d", &interval) == 1)
// found it, do something with interval
else
// didnt find it, maybe error
There are probably several other ways you could do it. If all the possible formats are "WORD ###", I would probably use strpbrk or strrchr for simplicity. strpbrk may be a bit more robust, since it will always tell you if it found digits, where as strrchr may find the last space, but after that may be another word (e.g. if you get bad data).
EDIT: It's not clear, from your post, whether there are other payloads you need to process, with other data besides interval (e.g. "LENGTH 500"). If you only have to deal with interval, sscanf may be easiest. If you have many different payload types, sscanf is probably not best/easiest.