title: Dumping memory to file
body: <p>I've got a part of my memory that I want to dump to a file. One reason is to save the information somewhere, and another is to read it again when my program restarts.</p>
  
  <p>What is the proper way of doing this?</p>
  
  <p>My first thought was:</p>
  
  <pre><code>char* start = my_pointer;
  int i;
  for (i = 0; i &lt; MEMORY_SIZE; i++) {
      // write *start to file
      start++;
  }
  </code></pre>
  
  <p>Can I write it all as characters? And then use something like this to restore it to memory. </p>
  
  <pre><code>//loop
      *my_pointer = fgetc(f);
      my_pointer++;
  </code></pre>
  
  <p>Will my "datastructures" survive as "charachters", or do I need to write it in some sort of binary / hexa data-mode? Or is it a stadard way of doing this?</p>