SHARE
TWEET

Untitled

a guest Dec 6th, 2019 96 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <stdio.h>
  2. #include<stdlib.h>
  3. typedef struct es{
  4.     char date[8];
  5.     char time[4];
  6.     float temp_out;
  7.     float hi_temp;
  8.     float low_temp;
  9.     int ouf_hum;
  10.     float dew_pt;
  11.     float wind_speed;
  12.     char wind_dir[3];
  13.     float wind_run;
  14.     float hi_speed;
  15.     char hi_dir[3];
  16.     float wind_chill;
  17.     float heat_index;
  18.     float thw_index;
  19.     float bar;
  20.     float rain;
  21.     float rain_rate;
  22.     float heat_dd;
  23.     float cool_dd;
  24.     float in_temp;
  25.     float in_hum;
  26.     float in_dew;
  27.     float in_heat;
  28.     float in_emc;
  29.     float in_air_density;
  30.     int wind_samp;
  31.     int wind_tx;
  32.     float iss_recept;
  33.     int arc_int;
  34. }macchina;
  35. int main()
  36. {
  37.     FILE *f1;
  38.     macchina v[100];
  39.     int c;
  40.        if((f1=fopen("dati.txt","r"))==NULL)
  41.        {
  42.            printf("Il file non e stato aperto correttamente\n");
  43.            return 1;
  44.        }
  45.        else
  46.        {
  47.            for(c=0;c<100;c++)
  48.            {
  49.             fscanf(f1,"%s\t",&v[c].date);
  50.             fscanf(f1,"%s\t",&v[c].time);
  51.             fscanf(f1,"%f\t",&v[c].temp_out);
  52.             fscanf(f1,"%f\t",&v[c].hi_temp);
  53.             fscanf(f1,"%f\t",&v[c].low_temp);
  54.             fscanf(f1,"%d\t",&v[c].ouf_hum);
  55.             fscanf(f1,"%f\t",&v[c].dew_pt);
  56.             fscanf(f1,"%f\t",&v[c].wind_speed);
  57.             fscanf(f1,"%s\t",&v[c].wind_dir);
  58.             fscanf(f1,"%f\t",&v[c].wind_run);
  59.             fscanf(f1,"%f\t",&v[c].hi_speed);
  60.             fscanf(f1,"%s\t",&v[c].hi_dir);
  61.             fscanf(f1,"%f\t",&v[c].wind_chill);
  62.             fscanf(f1,"%f\t",&v[c].heat_index);
  63.             fscanf(f1,"%f\t",&v[c].thw_index);
  64.             fscanf(f1,"%f\t",&v[c].bar);
  65.             fscanf(f1,"%f\t",&v[c].rain);
  66.             fscanf(f1,"%f\t",&v[c].rain_rate);
  67.             fscanf(f1,"%f\t",&v[c].heat_dd);
  68.             fscanf(f1,"%f\t",&v[c].cool_dd);
  69.             fscanf(f1,"%f\t",&v[c].in_temp);
  70.             fscanf(f1,"%f\t",&v[c].in_hum);
  71.             fscanf(f1,"%f\t",&v[c].in_dew);
  72.             fscanf(f1,"%f\t",&v[c].in_heat);
  73.             fscanf(f1,"%f\t",&v[c].in_emc);
  74.             fscanf(f1,"%f\t",&v[c].in_air_density);
  75.             fscanf(f1,"%d\t",&v[c].wind_samp);
  76.             fscanf(f1,"%d\t",&v[c].wind_tx);
  77.             fscanf(f1,"%f\t",&v[c].iss_recept);
  78.             fscanf(f1,"%d\t",&v[c].arc_int);
  79.            }
  80.        }
  81. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top