I have to program a new file in which I have to have multiple student info (like: Student_name, student_Surname, school_subject and number of student) in one line and I have to type in new students until I input END.
I have to use printf and scanf. Name, surname and subject can be multiple words When I try to use scanf("[^\n]*c", name), I can only enter info for one student and loop just ignores rest and for other students I can just type in student number which is integer. 
What is wrong with my code?
int main() {
    FILE *outputfile = NULL;
    struct imenik {
        char prezime[17 + 1];
        char ime[13 + 1];
        char predmet[20 + 1];
        int bodovi;
    } ucenik;
    outputfile = fopen("imenik.txt", "w");   
    printf("Ucitaj ime ucenika: ");
    scanf("%[^\n]%*c", ucenik.ime);
    printf("Ucitaj prezime ucenika: ");
    scanf("%[^\n]%*c", ucenik.prezime);
    printf("Ucitaj predmet: ");
    scanf("%[^\n]%*c", ucenik.predmet);
    printf("\nUcitaj broj bodova (0-50): ");
    scanf("%d", &ucenik.bodovi);
    fprintf(outputfile, "%s | %s | %s | %d\n", ucenik.ime, ucenik.prezime, ucenik.predmet, ucenik.bodovi);
    fclose(outputfile);    
}
 
     
     
     
    