Ask Me Help Desk

Ask Me Help Desk (https://www.askmehelpdesk.com/forum.php)
-   Internet & the Web (https://www.askmehelpdesk.com/forumdisplay.php?f=177)
-   -   What is strtok function body? (https://www.askmehelpdesk.com/showthread.php?t=4471)

  • Nov 3, 2003, 11:22 PM
    martyr
    What is strtok function body?
    What is strtok function body?
  • Nov 26, 2003, 07:56 AM
    tadds
    Re: What is strtok function body?
    Here is an example of its use.
    Not sure of it is what you were looking for.
    -------------------------
    #include <stdio.h>
    #include <stdlib.h>
    #include <string.h>

    int main(void)
    {
      char buff[200], delim[50], *ptr;

      printf("Enter up to 175 characters to examine (s1): ");
      gets(buff);
      printf("Enter a string for the delimiter (s2): ");
      gets(delim);
      ptr = strtok(buff, delim);
      for (;;) {
         if (ptr == NULL) {
            break;
         }
         printf("\nptr = %s", ptr);
         ptr = strtok( (char *) 0, delim);     /* Note the null pointer */
      }
    }

  • All times are GMT -7. The time now is 12:38 AM.