while (fscanf(fp, "%s%s%f%ld", SP.pinming, SP.guige, &SP.danjia, &SP.shuliang) == 4)怎么理解?
来源:学生作业帮助网 编辑:六六作业网 时间:2024/12/18 23:48:56
while(fscanf(fp,"%s%s%f%ld",SP.pinming,SP.guige,&SP.danjia,&SP.shuliang)==4)怎么理解?while(fscanf(fp,"%s
while (fscanf(fp, "%s%s%f%ld", SP.pinming, SP.guige, &SP.danjia, &SP.shuliang) == 4)怎么理解?
while (fscanf(fp, "%s%s%f%ld", SP.pinming, SP.guige, &SP.danjia, &SP.shuliang) == 4)怎么理解?
while (fscanf(fp, "%s%s%f%ld", SP.pinming, SP.guige, &SP.danjia, &SP.shuliang) == 4)怎么理解?
fsanf()和scanf()函数一样,都返回成功读取参数的个数.
该函数返回值与4比较结果作为循环条件时,如果成功读取4个参数的值,则继续,否则,就结束循环,这是个用法值得推荐,貌似比用feof(fp)函数更好用.