strsep(3) Library Functions Manual strsep(3) strsep - (libc -lc) #include char *strsep(char **restrict stringp, const char *restrict delim); glibc ( feature_test_macros(7)): strsep(): glibc 2.19: _DEFAULT_SOURCE glibc 2.19 : _BSD_SOURCE *stringp (NULL) strsep() NULL . *stringp delim. ('\0') *stringp . *stringp *stringp (NULL). strsep() *stringp. attributes(7). +------------+------------------------------------+--------------------+ || | | +------------+------------------------------------+--------------------+ |strsep() | | MT-Safe | +------------+------------------------------------+--------------------+ BSD. 4.4BSD. strsep() strtok(3) . . : o . strtok(3) : $ ./a.out 'a/bbb///cc;xxx:yyy:' ':;' '/' 1: a/bbb///cc --> a --> bbb --> --> --> cc 2: xxx --> xxx 3: yyy --> yyy 4: --> #include #include #include int main(int argc, char *argv[]) { char *token, *subtoken; if (argc != 4) { fprintf(stderr, "Usage: %s string delim subdelim\n", argv[0]); exit(EXIT_FAILURE); } for (unsigned int j = 1; (token = strsep(&argv[1], argv[2])); j++) { printf("%u: %s\n", j, token); while ((subtoken = strsep(&token, argv[3]))) printf("\t --> %s\n", subtoken); } exit(EXIT_SUCCESS); } memchr(3), strchr(3), string(3), strpbrk(3), strspn(3), strstr(3), strtok(3) 3 . . : . 6.18 25 2026 strsep(3)