title: errors when writing to a bin file
body: <pre><code>struct Seats seats[12];
  FILE* inp;
  FILE* opt;
  int counter = 1;
  char option;
  if ((inp = fopen(&quot;seats.bin&quot;, &quot;rb&quot;)) == NULL) {// open file to read
      printf(&quot;file did not open!&quot;);
      exit(0);
  }
  fread(&amp;seats, sizeof(struct Seats), 12, inp);// save file data to struct array
  
  //later in the code
  opt = fopen(&quot;seats.bin&quot;, &quot;w&quot;);
  fwrite(seats, sizeof(struct Seats), 12, opt);
  fclose(inp);
  </code></pre>
  <p>i have no problems reading the data from the bin file. however when i try to write to the file it stores  random values making it imposable to read when i boot up the program again.
  if you guys know the problem i would appreciate the help</p>