title: store and restore struct in file in C
body: <p>I need to store a struct in a file and read it back to return it then.
  I would try to write it to the file like this:</p>
  
  <pre><code>void lld_tpWriteCalibration(struct cal cal) {
      FIL fdst;      /* file objects */
     UINT bw;        /* File write count */
  
      /* Create destination file on the drive 0 */
      wf_open(&amp;fdst, "0:calibration.txt", FA_CREATE_ALWAYS | FA_WRITE);
      wf_write(&amp;fdst, cal, sizeof(cal), &amp;bw);
  
      wf_close(&amp;fdst);
  }
  </code></pre>
  
  <p>Would that work?
  And how can I read it back and return it from this function?</p>
  
  <pre><code>struct cal lld_tpReadCalibration(void) {
  
  }
  </code></pre>
  
  <p>The struct is:</p>
  
  <pre><code>   struct cal {
         float xm; 
         float ym; 
         float xn; 
         float yn; 
     };
  </code></pre>
  
  <p>Thanks for your help.</p>