Can anyone explain how things like strtok() and strstr() can be used to provide a numeric value for a substring location position within the mainstring array.
I've tried to understand from the C++ examples, but their 'position' locations of the substring within the mainstring (which I need) are returned in C++ as %d variables, whereas all I can get returned by the arduino 'char * pointer=' is the actual substring chars if they exist, rather than a number for their start position locations within the mainstring.
The C++ examples show that it is possible to discover the position values from %d, but how can I get that equivalent position value in arduino?
I want to be able to parse a char header[30] array for occurances of things like "s=123" and "d=789" in order to extract and assign the specified values to any appropriate variables (source or destination etc).
sscanf()
is way more appropriate for what you want to do than anystr*()
functions.