home *** CD-ROM | disk | FTP | other *** search
/ PC Extra Super CD 1998 January / PCPLUS131.iso / DJGPP / V2 / DJLSR201.ZIP / src / libc / compat / string / strsep.txh < prev    next >
Encoding:
Text File  |  1995-07-10  |  841 b   |  40 lines

  1. @node strsep, string
  2. @subheading Syntax
  3.  
  4. @example
  5. #include <string.h>
  6.  
  7. char *strsep(char **stringp, char *delim);
  8. @end example
  9.  
  10. @subheading Description
  11.  
  12. This function retrieves the next token from the given string, where
  13. @var{stringp} points to a variable holding, initially, the start of the
  14. string.  Tokens are delimited by a character from @var{delim}.  Each
  15. time the function is called, it returns a pointer to the next token, and
  16. sets *@var{stringp} to the next spot to check, or @code{NULL}. 
  17.  
  18. @subheading Return Value
  19.  
  20. The next token, or NULL.
  21.  
  22. @subheading Example
  23.  
  24. @example
  25. main()
  26. @{
  27.   char *buf = "Hello  there,stranger";
  28.   char **bp = &buf;
  29.   char *tok;
  30.   while (tok = strsep(bp, " ,"))
  31.     printf("tok = `%s'\n", tok);
  32. @}
  33.  
  34. tok = `Hello'
  35. tok = `'
  36. tok = `there'
  37. tok = `stranger'
  38. @end example
  39.  
  40.