-I've been able to get my program to work for just the first word in the file. But I want to create a loop for all of the words until end of file. But now I'm getting a segmentation fault. PLEASE HELP! I don't know how to get my program to work for all of them...Code:char getData(FILE* fp) { int i, j; char *ptemp; char **plist; char *list[MAXFILESIZE]; char temp[100]; //char *wordCounter[MAXFILESIZE];; *list = (char *)malloc(MAXFILESIZE * sizeof(char)); if(*list == NULL) { printf("NOT ENOUGH MEMORY!\n"); exit(100); } for(i = 0; i < MAXFILESIZE; i++) { while(fscanf(fp, "%[^ ' ' ^ \n]", temp[i++])!=EOF) { //wordCounter++; if(ispunct(temp[strlen(temp) - 1 ])) { (temp[strlen(temp) - 1]) = '\0'; } { for(i = 0; i < strlen(temp); i++) { temp[i] = tolower(temp[i]); } printf("temp:%s\n", temp); } } }
-Also, I have to use fscanf, its for an assignment. But yes, I realize that there are other functions that would make this easier.
Thank you in advance.