[求助]为什么这个语句不执行?
void add_product() { struct Product p1;
FILE *fp;
printf("To add a new product,you must input the details of the new product\n");
printf("please input the name of the new product,less than 20 letters: ");
gets(p1.name);
printf("\nplease input the ID of the new product: ");
scanf("%d",&p1.ID);
if((fp=fopen("products.dat","ab"))==NULL)
{
printf("\ncan not open file,it is not exist\n");
return;
}
fwrite(&p1,sizeof(struct Product),1,fp);
fclose(fp);
printf("\nsuccessful adding!\n");
getch();
}
这个函数我在MAIN中调用的时候红色语句并不停顿等待用户输入。。。怎么回事?