fscanf读取问题
#include<stdio.h>#include<stdlib.h>
#include<string.h>
#include<conio.h>
#include <ctype.h>
void main()
{
int l;
int num1=0,num2;
FILE*fp2;
if((fp2=fopen("E:\\52.txt","a+"))==NULL){
printf("Cannot open file strike any key exit!");
exit(0);
}
rewind(fp2);
fscanf(fp2,"%d",&num1);
num2=fscanf(fp2,"%d",&num1);
printf("%d",num2);
if(num1==0){
printf("没有记录,请按1\n");
scanf("%d",&num1);
fprintf(fp2,"%d",num1);
fscanf(fp2,"%d",&num1);
printf("你的编号是:%d\n",num1);
}
else{
printf("danqiang:\n",num1);
printf("+1:");
scanf("%d",&num1);
fprintf(fp2,"%d",num1);
printf("你的编号是:%d\n",num1);
}
fclose(fp2);
}
为什么fscanf()返回值为0??哪里错了??望高手指点