I am trying to read the data from file pointed by f
into my struct array: r_a[]
,
but I am getting the error: expected expression before r_a"
on the fscanf()
line.
header file:
void setAsset(FILE *f);
typedef struct rescue_asset{
char callsign[31];
char type;
char location[31];
double lat;
double lng;
double operational_speed;
int maxDeployDuration;
int lot_to_service;
}r_a[51];
c file:
#include "rescue_assets.h"
void setAsset(FILE * f)
{
int i = 0;
while (getchar() != EOF)
{
fscanf(f, "%s %c %s %f %f %f %d %d", &r_a[i].callsign, &r_a[i].type,
&r_a[i].location, &r_a[i].lat, &r_a[i].lng, &r_a[i].operational_speed,
&r_a[i].maxDeployDuration, &r_a[i].lot_to_service);
++i;
}
}