Hi,
I am trying to parse a line of text from a file into an array of character pointers. I am failing.
It is rather strange as I am parsing the text from the string, I can store the pointer and print to the screen. However, when I try to access the array of pointers after the parsing loop, I get an error.
Code:/* while there is more data in school file */ while( fgets(curSchoolLine, sizeof(curSchoolLine), school_csvHandle) != NULL ) { char * schoolTokens[7]; int s = 0; /* parse the current line into tokens by comma */ schoolTokens[s] = strtok(curSchoolLine, ","); while(schoolTokens[s] != NULL) { printf("school token: %s\n", schoolTokens[s]); schoolTokens[s] = strtok(NULL, ","); } /* end parse the current line into tokens by comma */ printf("school token: %s\n", &schoolTokens[1]) }



LinkBack URL
About LinkBacks


