title: How can I keep the position of a FILE pointer in a file in another file pointer?
body: <p>I have the following code in which the <code>tmp</code> <code>FILE *</code> does not keep the previous position of <code>fp</code> (which is 0). It actually changes along with <code>fp</code> when I use <code>fseek()</code>.</p>
  
  <p>Output:</p>
  
  <pre><code>fp=0 fp=40 tmp=40
  </code></pre>
  
  <p>How can I make it work such that <code>tmp</code> keeps the original position?</p>
  
  <pre><code>main()
  {
          FILE *fp,*tmp;
          char *name;
  
          name=getfilename();
  
          if((fp=fopen(name,"wb"))==NULL)
          {
                  puts("\n CAN'T OPEN FILE FOR SAVING...\n");
                  return ;
          } 
  
          printf("fp=%ld",ftell(fp));
  
          tmp=fp;
  
          fseek(fp,sizeof(int)*10,SEEK_SET);
  
          printf("fp=%ld tmp=%ld",ftell(fp),ftell(tmp));
  }
  </code></pre>