title: using a pthread read a file and perform an operation
body: <p>I am fairly new to C and I am making a C program that should works like this:
  it has one thread which reads a file with a double on each line of the file, and:</p>
  
  <ol>
  <li>it should be able to read files of any size.</li>
  <li>after reading the double it should perform this <code>n=atan(tan(n)</code> calculation.</li>
  </ol>
  
  <p>I have the following example:</p>
  
  <pre><code>void* ReadFile(void *file){
      char *str;
      str = (char*)file;
      printf("Opening File\n");
      FILE* f = fopen(str,"w");
      fclose(f);
      printf("Closing File\n");
  }
  
  void main(){
      pthread_t t1;
      pthread_create(&amp;t1,NULL,open_file,"data.txt");
      pthread_join(t1,NULL);
  }
  </code></pre>
  
  <p>where should I perform the operation? should it be in main or in ReadFile is also fine. The other problem I have is that how can you make sure it reads a file of any size? Should I use <code>sizeof(str)</code> in order to get the length/size of the file and then make a for loop that reads a line at each iteration and performs the calculation? Is this a good way of doing this in C?</p>