Skip to content

Instantly share code, notes, and snippets.

@GabrielL
Created August 17, 2011 13:28
Show Gist options
  • Save GabrielL/1151525 to your computer and use it in GitHub Desktop.
Save GabrielL/1151525 to your computer and use it in GitHub Desktop.
Simple use case for strsep
#include <stdio.h>
#include <string.h>
/*
* Split the argument by ','
*/
int main(int argc, char **argv)
{
char *token;
char *string = argv[1];
for (token = strsep(&string, ","); token; token = strsep(&string, ","))
{
puts(token);
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment