title: (C) - How would one compare 2 txt files REQUESTS.txt and AVAILABLE.txt, separating each str read into a (STR6, STR3, STR3, INT) formatted Structure?
body: <p>I have been working on this program for over a week with no breakthrough. The questions states as follows:
  A ​disc​ ​file​ ​‘REQUESTS.TXT’​ ​contains​ ​airline​ ​flight​ ​data formatted​ 
  <code>​(STR6,​ ​STR3,​ ​STR3,​ ​INT)​</code>.</p>
  
  <pre><code>Example:​  
  AA1011​SFx​LAx​​34​ ​(American Airlines​ ​1010,​ ​SF​ ​to​ ​LA,​ ​34​ ​seats)   
  W0924​DNV​DFW​​101​ ​(Western​ ​0924,​ ​DNV​ ​to​ ​DFW,​ ​101​ ​seats)
  </code></pre>
  
  <p>Another​ ​file​ ​‘AVAILABL.TXT’​ ​contains​ ​an​ ​unspecified​ number​ ​of​ ​reservation​ request​ ​records formatted​ ​identically​ ​as​ ​described​ ​above​ ​except​ ​the​ Seats​ ​Available​ ​field​ ​is​ ​a​ ​Seats​ ​Requested field.</p>
  
  <p>Guidelines:</p>
  
  <ol>
  <li>Read reservation flights and process requests. If the request can be fullfilled (i.e.. it is in AVAILABL and REQUESTS) then print "Reservation Processed", otherwise print "Reservation Denied".   </li>
  <li>Print out flight data file before and after reservations are processed, ordered by flight ID in a four(4) column format.  </li>
  <li>Print an overall outcome report for all processed.(Present totals for the number of requests satisfied and denied)</li>
  </ol>
  
  <p>I have tried a few different approaches.. I tried to split up the first STR6 by isalpha/isdigit and combine them to make the FlightID (AA + 1011). Proceeded to try to then split up the remaining characters between STR3 and STR3 via isalpha + for loop. And lastly, I tried to take the last 3+ digits for the # of seats during each for loop iteration and multiply the first digit by 100(for a 3-digit value) or 10(for a 2-digit value), adding it to a running total for availSeats(INT). This, at least I thought so, would produce a </p>
  
  <pre><code>AA+1011 = AA1011(STR6)  //  W+0924 = W0924(STR6)
  SFx(STR3)               //  DNV(STR3)
  LAx(STR3)               //  DFW(STR3)
  (3*10)+(4*1) = 34(INT)  //  (1*100)+(0*10)+(1*1) = 101(INT)
  </code></pre>
  
  <p>All of this stored within a Struct Array.<br>
  i.e...<br>
  <code>FlightData Flight;</code>       ............................................<code>FlightData Flight;</code><br>
  <code>Flight[0].flightID = AA1011;</code>    .........................<code>Flight[1].flightID = W0924;</code><br>
  <code>Flight[0].fromCity = SFx;</code>    ...............................<code>Flight[1].fromCity = DNV;</code><br>
  <code>Flight[0].toCity = LAx;</code>    ..................................<code>Flight[1].toCity = DFW;</code><br>
  <code>Flight[0].seatsAvail = 34;</code>    .............................<code>Flight[1].seatsAvail = 101;</code>    </p>
  
  <p>I am really at a loss right now and have no other way to progress other than searching up different techniques/methods to use to make this work. I am a beginner clearly and will continue to practice and progress in C, but if anyone could provide me with a push in the right direction on how one would execute this via .txt into a Struct would be amazing. Also, if anyone has another method they used to solve this problem I would love to analyze it. Thanks!</p>
  
  <p>(This is my first post, I spent a lot of time formatting it to be clear on Stackoverflow, so If i messed up in areas some constructive critisism would be useful! This applies to my posting and my coding practices. Thanks again!) </p>
  
  <p>EDIT: The question I am asking here is how to successfully take a string such as AA1011SFxLAx34 and turn it into a Structure like the above diagram. It must also work for the second string W0924DNVDFW101 which has only 1 Char in its ID. (rather than two in AA1011). Im not sure what else I am supposed to edit after reading the guidelines. </p>