Hello i have a little problem with my project. I want to scan the text from .TXT file into my struct except from the 1st line in my text file. I tried to do this with fgets()
function but it only works the first time.
here is a little effort from my work.
for (i=1;i<=number;i++){
fgets(s,100,fr);
fgets(p_akt->signatura,12,fr);
fgets(p_akt->isbn,15,fr);
fgets(p_akt->kniha,100,fr);
fgets(p_akt->autori,100,fr);
fscanf(fr,"%d",&p_akt->datum);
fscanf(fr,"%d",&p_akt->preukaz);
printf("%d.\n",i);
printf("signatura: %s",p_akt->signatura);
printf("isbn: %s",p_akt->isbn);
printf("kniha: %s",p_akt->kniha);
printf("autori: %s",p_akt->autori);
printf("datum: %d\n",p_akt->datum);
printf("preukaz: %d\n",p_akt->preukaz);
p_akt->p_dalsi = NULL;
}
As I said it runs exactly like I want only for the first loop ... When it enters the second cycle it moves everysingle information by 1 so in isbn i have signatura, in kniha i have isbn etc. I hope i made everything clear. Thanks
EDIT://
---
DE612301
9783161484100
Gesammelte Werke 3. Logik der Forschung
Karl R. Popper
20120508
56432
---
EN3123123
9780061092190
Men at Arms
Terry Pratchett
20101010
45612
This is my text file and i want to fill my struct with those information except the ---