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

  1. @node strtok, string
  2. @subheading Syntax
  3.  
  4. @example
  5. #include <string.h>
  6.  
  7. char *strtok(char *s1, const char *s2);
  8. @end example
  9.  
  10. @subheading Description
  11.  
  12. This function retrieves tokens from @var{s1} which are delimited by
  13. characters from @var{s2}.
  14.  
  15. To initiate the search, pass the string to be searched as @var{s1}.  For
  16. the remaining tokens, pass @code{NULL} instead. 
  17.  
  18. @subheading Return Value
  19.  
  20. A pointer to the token, or @code{NULL} if no more are found.
  21.  
  22. @subheading Example
  23.  
  24. @example
  25. main()
  26. @{
  27.   char *buf = "Hello there, stranger";
  28.   char *tok;
  29.   for (tok = strtok(buf, " ,");
  30.        tok;
  31.        tok=strtok(0, " ,"))
  32.     printf("tok = `%s'\n", tok);
  33. @}
  34.  
  35. tok = `Hello'
  36. tok = `there'
  37. tok = `stranger'
  38. @end example
  39.  
  40.