void addrecord(void)
{
system("color 2");
customer1 = fopen("customer1.txt","a+");
int num=0,x;
int base=0;
int regis=1000;
printf("\n\n\t\t\t PLEASE ENTER THE AMOUNT OF CUSTOMER YOU WANT TO ADD:");
scanf("%d",&num);
printf("\n\n\t\t\t PLEASE ENTER THE CUSTOMER INFORMATION BELOW");
for(x=0;x<num;x++)
{
printf("\n\n\t\t\t NAME: ");
fflush(stdin);
gets(info.Name);
printf("\n\n\t\t\t ADDRESS: ");
gets(info.address);
printf("\n\n\t\t\t NUMBER: ");
gets(info.number);
printf("\n\n\t\t\t TREATMENT: ");
gets(info.treatment);
printf("\n\n\t\t\t ALLERGIES: ");
gets(info.allergies);
printf("\n\n\t\t\t DATE OF BIRTH 12/12/12: ");
gets(info.dob);
printf("\n\n\t\t\t DATE OF LAST APPOINTMENT 12/12/12: ");
gets(info.app);
system("cls");
system("color 2");
if (customer1==NULL)
printf("\n\n\t\t\t FILE WAS NOT FOUND ");
else
{
regis++;
fprintf(customer1,"%d %s %s %s %s %s %s %s\n",regis,info.Name,info.address,info.number,info.dob,info.treatment,info.allergies,info.app);
}
}
fclose(customer1);
}
An exapmle of the file is below.
1001 Jason.Roberts 4.Clover.Road .............
1002 ..................................
1003 ................................
I would want to get the 1003 and then begin from there.


Sign In
Create Account


Back to top









