I have an assignment . I need to recive Data from a text file into an array of structures (in func,not in main). struct
>#define INPUT_FILE "c:\\in.txt"
#include<stdio.h>
#include<stdlib.h>
typedef struct
{
int serial;
char name[15];
char dest[20];
int taken;
int date;
}flight;
void flights()
{
FILE *fin;
int taken,date,serial;
char name[15],dest[20];
fin=fopen(INPUT_FILE,"r");
if (fin=NULL)
{
printf("Eror in opening file %s\n",INPUT_FILE);
exit(1);
}
fscanf(fin,"%d",&serial);
fgets(name,15,fin);
fgets(dest,20,fin);
fscanf(fin,"%d%d",&taken,&date);
}
I don't know how to import the date from the text file into the array of structures. Thanks all