#include<stdio.h>
#include<stdlib.h>
int main()
{
struct {
char origin[50];
char destination[50];
char flight[10];
char aircraft[3];
char days_of[7];
char departure[4];
char arrival[4];
char begin_date[10];
char end_date[10];
}flight_details[1679];
FILE *fp;
fp=fopen("iaschedule-07(edit).csv","r");
char buf[50];
int i;
while( fgets(buf,sizeof(buf),fp) != NULL)
{
strcpy(flight_details[i].origin, strtok(NULL,","));
strcpy(flight_details[i].destination, strtok(NULL,","));
strcpy(flight_details[i].flight, strtok(NULL,","));
strcpy(flight_details[i].aircraft, strtok(NULL,","));
strcpy(flight_details[i].days_of, strtok(NULL,","));
strcpy(flight_details[i].departure, strtok(NULL,","));
strcpy(flight_details[i].arrival, strtok(NULL,","));
strcpy(flight_details[i].begin_date, strtok(NULL,","));
strcpy(flight_details[i].end_date, strtok(NULL,","));
++i;
}
printf("print details\n");
for (int j=0; j<10; j++)
{
printf("Origin : %s", flight_details[j].origin);
printf(", Destination : %s\n",flight_details[j].destination);
}
return 0;
]
I am new to C, I get a list of warnings and errors saying. one of the warnings is, incompatible implicit declaration of built-in function strcpy.
could someone please help me clean this up I think i have alt of syntax problems.