Created
March 14, 2013 15:15
-
-
Save omerk/5162182 to your computer and use it in GitHub Desktop.
strtok() example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <string.h> | |
int | |
main (void) { | |
char test_string[] = "machinename.local"; | |
char* result = NULL; | |
result = strtok(test_string, "."); | |
printf("First token: %s\n", result); | |
/* | |
while ( result != NULL ){ | |
printf("Next token: %s\n", result); | |
result = strtok(NULL, "."); | |
} | |
*/ | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment