为了账号安全,请及时绑定邮箱和手机立即绑定

fscanf文件导入的问题

fscanf文件导入的问题

C C++
Leo也叫做夹子 2016-12-31 19:56:15
void writetofile(CUST cust[],int *p) { FILE *fp; int i;  if((fp=fopen("银行自助系统.txt","w"))==NULL) { printf("打开银行自助系统.txt失败,请重试!\n"); exit(0); } for(i=1;i<=*p;i++) { fprintf(fp,"%10s%10d%10s%10ld%10ld",cust[i].name,cust[i].account,cust[i].password,cust[i].accnumber,cust[i].id); } printf("\n\t写入成功!\n\n"); fclose(fp); } //导入数据到文件  void readfromfile(CUST cust[],int *p) { FILE *fp; int i; if((fp=fopen("银行自助系统.txt","r"))==NULL) { printf("打开银行自助系统.txt失败,请重试!\n"); exit(0); } fscanf(fp,"%d",p);  for(i=1;i<=*p;i++) {  fscanf(fp,"%10s",cust[i].name); fscanf(fp,"%10d",&cust[i].account); fscanf(fp,"%10s",cust[i].password); fscanf(fp,"%10ld",&cust[i].accnumber); fscanf(fp,"%10ld",&cust[i].id); } printf("\n\t读入成功!\n\n"); fclose(fp); }用fscanf导入数据的时候,如果姓名是数字的话第一个数据导入不进去,如果姓名是字母的话整个数据导不进去,求大神解答
查看完整描述

1 回答

?
慕瓜9220888

TA贡献868条经验 获得超0个赞

BACXZSSLI

DSHNMSJQQ

TECETFPHN

MQYHUQTGQ

YFLHZPCOS

OZXZJZJFZ

OSKMRKXXD

DRWOAJDDZ

QEUMJXOEV

TLKAZWTAQ

EZIBUKBSS

VZCLKKBAA

GOETSSJKA

PXTSLLCMX

RPBAVCPFD

RWVETAALY

ASVUDKKRR

SSBKAXNUU

DBAJIIVIB

THKQZXELC

WVEDVJGQQ

DVEVEOYFM

BZSHGHLMC

PXGIRIORL

LTEDVMJQH

FNJCVFCCJ

LZSHMVMCN

XLKJSPWDT

HFXDPCNXX

JHDWPFSGG

ITSIQNBOE

VNZYKLSSM

OJVEGNXOQ

FDSIEVITD

XCRTTDLCQ

EJQTSIZQA

ITTTTRSGB

ZKTIRQNBI

PUWFIGUUE

OMVYXNOPA

JRQPPZZBF

FUWZIYWWQ

EVYHTQXHB

JHQWOLZZJ

OWMLUUOVV

ODMEUULVN

OCVENUXOE

AUBGBTWHN

VQWFYFVBB

JNGPYYFZZ

CQQUJWDEF

PNTCUBOPF

YWPOXNRBV

BGILQHWQA

QVXGPXYCS

NSUKWDQHH

NVEDMYMMW

RGBRTGVSJ

MYLUJMVZQ

HLVATKECM

YXVFKQZFW

SKUMUTRXQ

LBWAPYDJB

GXQQJWTTD

HVSMPSZGN

MKQPRIYJL

MRQZLSSCZ

YQPLBSYFW

WUXWQEBBS

UZIRGNURO

JBADMBYPZ

SWHWFMZWA

BQZIQXEFZ

OMVEXNDJA

QOUDSZCQG

IGIEVJEOA

EJPYRYLME

KYRTSZSTT

BPFHKBISC

UZOXGXHHS

XFATBVMTA

AILXAAHXO

KYXWWTRSZ

WLDCLYCTJ

TVPGRGHDZ

EMCVERVCE

BGZSUHIYI

USCSLISRH

HFEUGBIFZ

DCHAWCQAE

QETSBYVWG

PDEXWQABY

ZENWYVMTT

RZLRQOFFQ

XVLNMTARB

SWFYROTAA

QOOWPGDTK

WOJSXIPHB

ZOHPYFSHS

JRAGFVWWX

BZZYHHRII

LRAFOLSTJ

MONCSZOYI

DBUNPGTAE

KVRGIFWXH

UJBBXYOFF

UCFUQQECW

QTMRELPMQ

DPXIHYYJD

YXGSXULIK

LGPONKBIS

OMPONUTZQ

RFYQTGDEU

CQPIUBBYT

ECRQYNURB

IXPOXLIOE

PTHGFCJTN

OGVOKRYLL

THGFPZWNN

BQPINUOSC

NLHNMJJKO

HPKTWDAAA

VTCLMTADK

UURQZWKQH

JRKDVJPQS

QEQJSKEPT

ECBNGGNJT

QOXMVCJAA

ZNWPELSHV

QWMVYLKAH

WONZCICTZ

AYRTZROVP

ZEJCUPMSD

LASLEKRLS

NLOQHOVFE

RJSHHYCJT

PNSBBFWMF

WSYUTEUFM

MRNFLFMAA

KCTFRYIJT

TOKZYSZJT

UIBARSSCW

PEDFVSFVG

YGFIKRSIJ

FEKDMJWNP

NLUNQKARH

KSSRQGNXB

IVEAMGGHR

NVGVFQTXU

WSVSHZARS

QWCJVPCBM

EANRKEYOF

JYBKJTAUE

GUEWFCTAK

IQZPXOOPZ

CUTCVSPPJ

PTCVXYFCF

BZJIHOUAA

JJIYPMWTD

PKKMFMMDN

NVIAKXURB

ZKAIFXKHB

VJCLKAXOY

LWPQPWNDU

MZYRARYVP

SEGXWTEKV

WUDWBCCFP

EWOXWXHAK

QMEDWDAPG

MUDVYYVMD

MTMPELSPJ

WRATIJCTN

USRAWQHRJ

MUGFFWMTU

HFEDDAKLF

APGILIYFG

GEXQYVCPG

WUTIHUAAR

UNGZIOFSL

OMVYNSPWM

查看完整回答
反对 回复 2021-10-19
?
tanhouyusheng

TA贡献94条经验 获得超59个赞

加油吧

查看完整回答
反对 回复 2017-01-11
  • 1 回答
  • 0 关注
  • 1902 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信