saveptr
Saveptr is a term associated with the POSIX reentrant string tokenizer strtok_r. It refers to the external state that the function uses to resume tokenization between calls. The strtok_r function has the prototype char strtok_r(char str, const char delim, char saveptr). The saveptr argument is a pointer to a char variable supplied by the caller; strtok_r writes the current parsing position into this variable so subsequent calls can continue from where the previous call left off.
Usage pattern: on the first call, provide the input string in str and a valid saveptr variable,
Important considerations: the caller owns the saveptr and must ensure it remains valid for the duration of
Compared to strtok, strtok_r avoids shared state and is therefore suitable for multi-threaded programs, provided separate