#include <string.h>
|
|
char *
strsep (char **stringp, const char *delim); |
strsep function returns a pointer to the token, i.e it returns the original value of *stringp
An "empty" field (i.e., a character in the string delim occurs as the first character of *stringp) can be detected by comparing the location referenced by the returned pointer to ‘\0’.
If *stringp is initially NULL, strsep returns NULL.
#include <string.h>
#include <stdio.h>
int main()
{
char *one=(char *)malloc(12);
char *res;
char **two=&one;
strcpy(one,"Hello,World");
res=strsep(two,",");
if(strcmp(res,"hello"))
printf("%s\n",res);
return 0;
}
Output
Hello
|
© 2005-2007 Nokia |