title: Writing entries in an array of structures on file in C
body: <p>I'm writing a program in C and try to save an array of structures to a file.
  My intention is to initialize an array of structs and save it to a file. Further I want to modify the entries of struct-entry 1, struct-entry 2, struct-entry 3 etc. But the entries are not written to the file. There even seems not to exist any array of structs. </p>
  
  <p>I would appreciate any help, because I can't figure out, why the array is not written to  file.</p>
  
  <p>Thank you
  Threx</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  #include &lt;string.h&gt;
  
  struct liste {
      unsigned int code;
      unsigned int activ;
      };
  int main()
  {
  int z;
  
  printf("Enter Index: "); /* Data should fill the z-th entry in array of structures */
  scanf("%d",&amp;z);
  
  FILE *mrp;
  struct liste bauteil[5]; /* Array with 5 structs for 5 different entries */
  
  mrp = fopen("aaa.txt","w+b");
  
  printf("Number of entry is: %d\n",z);
  printf("Enter code: ");
  scanf("%d",&amp;bauteil[z].code);
  bauteil[z].activ=77777; /* activ entry contains 77777 */
  
  fseek(mrp, z * sizeof(struct liste), SEEK_SET);
  fwrite(&amp;bauteil[],sizeof(bauteil),1,mrp);
  
  fclose(mrp);
  return 0;
  }
  </code></pre>