title: fwrite => fprintf
body: <p>I'm having trouble changing the line <code>fwrite(tmp_array, sizeof(int), num, f);</code> to <code>fprintf</code>.</p>
  
  <p>Can someone please take a look for me?</p>
  
  <pre><code> void generate_random_sorted_file(const char *file_name, int num)
   {
       FILE *f = fopen(file_name, "wb");
       if (f==NULL) 
       {
           printf("could not open %s\n", file_name);
           return;
       }
  
       int *tmp_array = calloc(num, sizeof(int));
       int i;
  
       for (i=0; i&lt;num; i++)
       tmp_array[i]=rand();
  
       qsort (tmp_array, num, sizeof(int), compare); /* sorts the array */
       fwrite(tmp_array, sizeof(int), num, f);
  
       fclose(f);
   }
  </code></pre>