Q: When I use strtok on a line like "Word1,,Word2", it'll parse it into "Word1" and "Word2" rather than "Word1", "", and "Word2". Is there something other than strtok I should be using to parse the string when it has a blank column, or do I need to put something between all of the commas before I can parse the data?
A: Inserting a token in between pairs of commas would work, but I wasn't planning that you would have to do that. This part of the project could be solved with other string functions, but I already told you to use strtok and showed you how to use strtok. So I'm going to make another data file that has an underscore wherever there is missing data. This file will be called classroomTunes2.csv. Use this data file, unless your program already works with the first one.
Q: I just wanted to know if we had to store into our structs that first line of data (i.e. name, artist, composer album ....) or if our first struct (tunes[0]) should match with the first song given (so for the test data "Like Rasputin).
A:The header line has to be handled separately; the types are wrong to go into your structs. You can remove that line while you test the rest of your code, then add it back later.
Q: For number 7, you ask for an error message. Can I just have it use the default filename instead?
A: Yes.
Q: The project requires a function that only takes a FILE * and returns a struct, but my design will work better if the function takes a FILE * and the name of a file. Can I do that?
A: No, because the FILE * has to already be open when you pass it to the file.
Q: Is there an example file that shows the syntax for the very last part of the project?
A: Do not work on number nine until your whole program works flawlessly - then save a copy and look at the example code online in structPointerArray.c.
Q: I'm getting weird problems with segmentation faults using fgets. Even if I test the file pointer right after calling fgets and the file pointer is ok, I still get a seg fault. What else can I do?
A: One last thing you can try is to say:
char* test;
test = fgets(line,100,fptr);
if (test == NULL)
return whatever it is you return.