Code:
void create_customer()
{
FILE *customer_fp;
customer_indexed indexed_array[FILE_SIZE]; //255
customer_record new_record;
int i;
customer_fp = fopen("test.bin", "wb");
printf("Input customer first name: ");
scanf("%s", new_record.first_name);
printf("Input employee last name: ");
scanf("%s", &new_record.last_name);
fwrite(&new_record, sizeof(new_record), 1, customer_fp);
fprintf(customer_fp, "\n");
fclose(customer_fp);
}
I am trying to write this to a binary file. It wont be implemented using scanf later, its just to see if its working for now.
I have another file to read the binary file, but it will only allow me to add one entry. I am calling the function twice in main.
Any suggestions?
Thanks