Created
September 20, 2013 08:26
-
-
Save upa/6634704 to your computer and use it in GitHub Desktop.
strsplit
This file contains hidden or 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
| int | |
| strsplit (char * str, char ** args, int max) | |
| { | |
| int argc; | |
| char * c; | |
| for (argc = 0, c = str; *c == ' '; c++); | |
| while (*c && argc < max) { | |
| args[argc++] = c; | |
| while (*c && *c > ' ') c++; | |
| while (*c && *c <= ' ') *c++ = '\0'; | |
| } | |
| return argc; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment