title: i need to copy bitmap image file in c language using a buffer
body: <p>i have to copy a bitmap image file using a buffer. 
  here is an example of what i need to do.
  i have to read different parts of a bitmap into the buffer first at once and then write it to the target file.
  when i read different parts into the buffer , the previous string gets overwritten and the last string that is read is only written. i dont want to use read and write function for every part that has to be written.
  please help me with the code.</p>
  
  <pre><code>#include &lt;conio.h&gt;
  #include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  
  void fskip(FILE *fp, int num_bytes) {
    int i;
    for (i = 0; i &lt; num_bytes; i++)
      fgetc(fp);
  }
  
  int main() {
    FILE *fp, *fp1;
  
    fp = fopen("c:\\users\\tapan\\desktop\\splash.bmp", "rb");
    fp1 = fopen("c:\\users\\tapan\\desktop\\splash2.bmp", "wb");
  
    int *j;
    j = (int *)malloc(3000);
  
    int k = 223121;
    int *i = &amp;k;
  
    fread(j, 2, 1, fp);
  
    fread(j, 10, 1, fp);
    fwrite(j, 12, 1, fp1);
  
    fclose(fp1);
    fclose(fp);
  
    getch();
  }
  </code></pre>