I have to read a csv file using fscanf function (I cant use any other function like strtok_s to parse the line) and im having the following problem.
Here is the code:
fp1 = fopen (argv [1],"r");
var = fscanf (fp1,"%d,%d,%[^,]s,%[^,]s",&aux.points,%aux.titles,aux.name,aux.nation);
I'm trying to print each parameter in the screen. There is no problem with the integers and even with the first string (name) but nothing is stored in the next string (nation).
I assume that the first %[^,]s is stopping the execution of the whole fscanf function so the next string is never read. Any idea? I have tried everything but this is just not working.