fgets moving on to a newline
im making a quiz right now and i have two txt files one with questions another with answers
this is a piece of my code
Code:
do{
fgets(vraag,100,vragen); /*neem een vraag uit vragen.txt*/
printf("%s\n",vraag); /*print de vraag*/
fgets(antwoord,100,antwoorden); /*haal antwoord uit de file*/
gets(antwoord_eigen); /*scanf antwoord als een string*/
if(strcmp(antwoord,antwoord_eigen)==0){ /*vergelijk de antwoorden uit txt en scanf*/
printf("Het antwoord is correct\n");}
if(strcmp(antwoord,antwoord_eigen)==1){
printf("Het antwoord is verkeerd het juiste antwoord was:%s",antwoord);}
}
while(strcmp(antwoord_eigen,stop)==0); /*typt men stop dan stopt het programma*/
sry for the probably unreadable language
vraag=question and antwoord=answer
anyway i manage to get one question out of the txt file and one answer out of the txt file but now i want to move on to the next line where the next question is and the next answer so i have to
do something with fgets(vraag,dunno probably here something to go to the next line or...,vragen);
and the same thing for the answers