title: scanning files into nested structures
body: <p>So I have tried looking for something similar to my situation but I cant find anything that helps or that is simple enough for me to understand. </p>
  
  <p>My issue I am sure is not difficult, but I do not know how to do the following:</p>
  
  <p>I have a structure within a structure and need to scan in multiple files into the main structure.
  This is what I have and the point where I am stuck is in messages. I feel as though I may need one more structure, but again I am not sure </p>
  
  <p>these are my structures</p>
  
  <pre><code> typedef struct {
  int year;
  int month;
  int day;
  char time[9];
   } datetime_t
  
   typedef struct
   {
  datetime_t datetime;
  double latitude;
  double longitude;
  double magnitude;
  double depth;
  char location[LOCATION]
   } data_t
  </code></pre>
  
  <p>here is my scanning file</p>
  
  <pre><code>  void scan_data(data_t Alaska[], data_t Central[],data_t Inner[],
   data_t East[],data_t West[],data_t Canada[MAX_INFO])
   {
  int i=0; 
  FILE *FAlaska;
  FILE *FCentral;
  FILE *FInner;
  FILE *FEast;
  FILE *FWest;
  FILE *FCanada;
  
  FAlaska = fopen("Alaska.txt", "r");
  FCentral = fopen("Central.txt", "r");
  FInner = fopen("InnerMountain.txt", "r");
  FEast = fopen("NorthEast.txt", "r");
  FWest = fopen("NorthWest.txt", "r");
  FCanada = fopen("NorthernCanada.txt", "r");
  
  while  (i &lt; MAX_DATA &amp;&amp; 
      fscanf(FAlaska, "%s", data[i].datetime) !=EOF) /*here is my issue*/
  {                                                      
      fscanf(FAlaska, "d", data.latitude);
  }
  fclose(FAlaska);
  return;
    }
  </code></pre>
  
  <p>I am not sure how or if I can scan data into a structure within a structure?
  Do you do data[I].datetime.year?
  or scan into datetime as a separate array/struct and then assign it later to the bigger struct?</p>
  
  <p>any help would be much appreciated on how to do this. Thank You. </p>