#include #include "prog03header.h" int read_planets(Planet *planets) { int i; FILE *fp; if( (fp = fopen("planet.txt", "r")) == NULL ){ return -1; } for (i = 0; i < NPLANETS; i++) { if( fscanf(fp, "%s %lf %lf %lf", planets[i].name, &planets[i].radius, &planets[i].density, &planets[i].semi_major_axis) != 4 ) { fclose(fp); return -1; } } fclose(fp); return 0; }