actually i just wanna clear evrything that is in the string antwoord en vraag en then i wanna move a line down in each txt file where the next question and next answer is ...
No, problem.
Code:
void clear_string(char *mystring, int size)
{
int i;
for(i = 0; i < size; i++)
{
mystring[i] = '\0';
}
}
@fgets(): look in my posting above ... I've edited it.
Code:
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);}
Remember: strcmp() returns 0 if the two strings match but it returns !=0 if the strings don't!
(if string1 > string2 --> returns >0 and if string1 < string2 --> returns <0)
It is not necessary to call strcmp() two times. You can use if ... else ...
Code:
if(strcmp(antwoord,antwoord_eigen)==0)
{
printf("Het antwoord is correct\n");
}
else
{
printf("Het antwoord is verkeerd het juiste antwoord was:%s",antwoord);
}