I want to scan a string which is made from a fixed number of strings comma separated.
For example
source string = str1,str2,str3,str4
I want to extract the four strings "str1", "str2", "str3" and "str4".
The problem is that one (or more of the strings) can be empty.
For example
source string = str1,str2,,str4
I want to extract the four strings "str1, "str2", "" (i.e. empty string), "str4"
All the functions I tested (sscanf, Scan , strtok) handle multiple occurrences of delimiter as single occurrence and so I get
"str1", "str2", "str3
Which function can I use?