Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // apple xcode
- // paulogp
- /* token: separacao de strings */
- #include <stdio.h>
- #include <string.h>
- void token (char *the_input);
- void token (char *the_input)
- {
- the_input = strtok (the_input, " ,.-");
- while (the_input != NULL)
- {
- printf ("%s\n", the_input);
- the_input = strtok (NULL, " ,.-");
- }
- }
- int main (int argc, const char * argv[])
- {
- char the_input[100]; // max 100 digits
- char *the_input_ptr;
- printf("texto: ");
- fgets(the_input, sizeof(the_input), stdin);
- // removes \n from the end
- // NOTE: the_file_ptr points to the_file_name
- the_input_ptr = strtok (the_input, "\n");
- token (the_input_ptr);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement