I make some research in order to look for the sscanf() source code . But I could not find the answer to my question.
when we use sscanf() in this way:
char str[50] = "5,10,15";
int x;
sscanf(str,"%d,%s",&x,str);
Does sscanf() support “recursive” buffer str ?
It doesn’t break from self modifying buffer. But to make it (tail)recursive, you’d have to read to the end of the string.
The code fragment:
reads all the integers.
Since this is not really recursive and the string to be read doesn’t overwrite the asciiz in the string, I believe this is “safe” in the meaning: only try this at home.