STURCT:
Code:
typedef struct date_Of_Birth {
short int day;
short int month;
short int year;
}DATE;
typedef struct student {
int pin;
char fname[30];
char lname[30];
DATE date;
float gpa;
}STUDENT;
Code:
void create_List(int size) {
STUDENT* p_Stu = (STUDENT*)calloc(size, sizeof(STUDENT)); //struct pointer
if (p_Stu == NULL)
fail();
char n_F_Name[200];
int i, len = strlen(n_F_Name);
FILE* fCreate;
fCreate = NULL;
printf("Enter a name for a file: ");
fgets(n_F_Name, 200, stdin);
/*for fail
printf("File with given name already exists.\n");
system("pause");
system("cls");
choice_Of(1);
fclose(fCreate);
for success
strcat(n_F_Name, ".txt");
fCreate = fopen(n_F_Name, "w");
if (fCreate == NULL)
fail();*/
for (i = 0; i < size; i++)
//long for loop for input, works without file check
fclose(fCreate);
free(p_Stu);
}