going straight to the problem here , i need to scan an imput of a sentence like : Name and Surname at once and it doesn't work properly tried scanf like shown in title and also fgets , at first it worked fine but once the code is a bit complex it jams ! am including a picture with the executed code
*// note this function is called by main(); tried writing the code in the main but the same
#include <stdio.h>
#include <string.h>
#include "Typedefs.h"
User Newuser;
log()
{
printf("Name & Surname : ");
fgets(Newuser.FullName,TAILLE_MAX,stdin);
printf("Age : ");
scanf("%d",&Newuser.age);
printf("Matricule : ");
scanf("%lld",&Newuser.MaT);
printf("%s %d years \t Matricule : %lld",Newuser.FullName,Newuser.age,Newuser.MaT);
fichier = fopen("userlog.txt","a+");
if(fichier != NULL)
{
fprintf(fichier,"%s %d years \t Matricule : %lld",Newuser.FullName,Newuser.age,Newuser.MaT);
fclose(fichier);
}else
{
printf("error opening file!");
}
}