Parsing words divided by commas or spaces in a text file- Can I overcome the commas with scanf?
===

I have a text file which contains lines, such that every line contains no more than 80 chars. every line contains (one or more words) divided by **commas or spaces**. I need lexicography sort the words. I want to use **scanf** with the symbol "%s" of strings, but it considers only spaces. So I guess I can't. any smarter way to deal with the parsing the words than  get char by char?

Here's a sketch of what I was planning to do:

 

       char**arr;
    	arr=calloc(Size, sizeof(char)*80);
    	int m=0;
    	while (!feof(file)) {
    
    		char c=fgetc(file);
    		while (c!='/n') {
    			int j=0;
    			char* current;
    			current=calloc(1,sizeof(char)*80);
    			while (c!=','&& c!=' ') {
    				current[j]=c;
    				j++;
    			}
    			current[j]='\0';
    			arr[m]=current;
    			
    			free(current);
    
    		}
    	}