Warning: main(/www/www/htdocs/style/globals.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/s/strsep.html on line 1
Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/globals.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/s/strsep.html on line 1
Warning: main(/www/www/htdocs/style/header.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/s/strsep.html on line 8
Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/header.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/s/strsep.html on line 8
Separate a string into pieces marked by given delimiters
#include <string.h>
char *strsep( char **stringp,
char *delim );
- stringp
- The address of a pointer to the string that you want to break into
pieces; see below.
- delim
- A set of characters that delimit the pieces in the string.
libc
Use the -l c option to
qcc
to link against this library.
This library is usually included automatically.
The strsep() function looks in the null-terminated string
pointed to by stringp for the first
occurrence of any character in delim and replaces this with a
\0,
records the location of the next character in *stringp,
then returns the original value of *stringp.
If no delimiter characters
are found, strsep() sets *stringp to
NULL; if *stringp is initially NULL,
strsep() returns NULL.
A pointer to the original value of *stringp.
Parse strings containing runs of whitespace, making up an argument vector:
char inputstring[100];
char **argv[51], **ap = argv, *p, *val;
/* set up inputstring */
for (p = inputstring; p != NULL; ) {
while ((val = strsep(&p, " \t")) != NULL && *val == '\0');
*ap++ = val;
}
*ap = 0;
Unix
Safety: | |
Cancellation point |
No |
Interrupt handler |
Yes |
Signal handler |
Yes |
Thread |
Yes |
strtok(),
strtok_r(),
wcstok()
Warning: main(/www/www/htdocs/style/footer.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/s/strsep.html on line 138
Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/footer.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/s/strsep.html on line 138