问题描述
在这里直接解决问题,我需要立即扫描一个句子的输入:名称和姓氏,并且它不能正常工作,如title和fgets所示尝试scanf,起初它可以正常工作,但是一旦代码有点麻烦!包括一张带有执行代码的图片
*// 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.MaT);
fclose(fichier);
}else
{
printf("error opening file!");
}
}
this linked image shows the panel of code running
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)