I'm working on a task where I need to read a long .txt file. The first line contains the number of lines the .txt file has, the rest of the lines follow the same structure, "int int int char:char".
How do I read the first line separately from the rest?
I wrote the following code:
FILE *fajl;
falj = ("musor.txt", "r");
while (!feof(fajl) && fajl > 1)
{
fscanf_s(fajl, "%d %d %d %[^:]c:%c\n", &tomb[i].ado, &tomb[i].perc, &tomb[i].masodperc, &tomb[i].eloado, &tomb[i].cim);
i++;
}
Sorry for the unknown words, the variable names are in Hungarian.