Skip to content

Instantly share code, notes, and snippets.

@omerk
Created March 14, 2013 15:15
Show Gist options
  • Save omerk/5162182 to your computer and use it in GitHub Desktop.
Save omerk/5162182 to your computer and use it in GitHub Desktop.
strtok() example
#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