This program is to read data from standard atmospheric table
#include <stdio.h>
//read file standardatm.txt. read only alt, temp, pressure
main( )
{
FILE *atmfile, *fpt;
char alt[10],temp[10],pres[10] ;
float a, t, p;
char dummy[10];
int k=0, i=0;
atmfile = fopen("standardatm.txt","r");
for(k=0;k<98;k++)
{
fscanf(atmfile,"%s",dummy);
}
fscanf(atmfile,"%s %*s %*s %*s %s %s %*s %*s %*s %*s %*s ",alt,temp,pres);
printf("%s %s %s\n",alt, temp, pres);
for (i=0;i<42;i++)
{
fscanf(atmfile,"%f %*f %*f %*f %f %f %*f %*f %*f %*f %*f \n ", &a, &t,&p);
printf("%4.1f %4.1f %6.f \n",a, t, p);
}
fclose(atmfile);
}
Pages: 1 2