I am making a linked list of World Cup teams, when loading the teams I need to do a preload reading data from a csv file but reading 2-word countries makes it wrong
For example
Suppose that this is the csv file:
Arabia Saudita, Herve, Renard, Salman, C, 0, 1
First I read the country name, dt name, captain name, group and two numeric values that are part of the program, but the output is something like this:
Country:Arabia DT:Saudita Herve Renard Salman C 0 1 Captain: empty Group:Empty
The expected output would be
Country: Arabia Saudita DtName:Herve DtSurname:Renard CaptainName:Salman Group: C
I tried to do it with a txt file but it is the same since it reads the spaces and the program fails or prints wrong
This is a part of the code that fails
FILE *chargue = fopen("Precharge.csv", "r");
while (!feof(charge)) {
fscanf(charge, "%s\n", countryAux);
chargecountry(&team, countryAux);
fscanf(charge, "%s\n", nameDTAux);
fscanf(charge, "%s\n", surnameDTAux);
chargenameDT(&team, surnameDTAux, nameDTAux);
chargeCapitan(&team, nameCapaux);
fscanf(charge, "%c\n", &groupAux);
chargegropu(&team, groupAux);
fscanf(charge, "%d\n", &actualscoreaux);
chargeactualscore(&team, actualscoreaux);
fscanf(charge, "%d\n", &faseActualaux);
chargeFase(&team, faseActualaux);
insert(lis, team);
forwards(lis);
}