Hi , I'm trying to figure out how to add new data to a file using a structure and a function. I have some of the code required but I am struggling with how to add the actual new members of the new data(within the structure) to the file.
//this is just a sample to my full code
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
struct cust_rec
{
int cust_id;
char firstname[11];
char surname[21];
int age;
char gender;
char address[41];
};
void new_cust(void);
main()
{
new_cust(void);
system("PAUSE");
}
void new_cust(void)
{
/*
this is the point where I don't understand where I am to assignment the new
data to the structure template
-- i know a file needs to be opened for new data to be entered but its the actual adding of the data which has me bothered.(basically all the code within the function)
*/
printf("Please Enter New ID");
printf("Please Enter New Firstname");
printf("Please Enter New Surname ");
printf("Please Enter New Age");
printf("Please Enter New Gendre");
printf("Please Enter New Address");
}