title: Segmentation fault on the server, but not local machine
body: <p>As stated in the title, the program is working on my local machine (ubuntu 9.10) but not on the server (linux). It's a grid hosting hosting package of godaddy.</p>
  
  <p>Please help..</p>
  
  <p>Here is the code:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  
  int main(int argc, char **argv)
  {
      long offset;
      FILE *io;
      unsigned char found;
      unsigned long loc;
  
      if (argc != 2)
      {
          printf("syntax: find 0000000\n");
          return 255;
      }
  
      offset = atol(argv[1]) * (sizeof(unsigned char)+sizeof(unsigned long));
  
      io = fopen("index.dat","rb");
      fseek(io,offset,SEEK_SET);
      fread(&amp;found,sizeof(unsigned char),1,io);
      fread(&amp;loc,sizeof(unsigned long),1,io);
  
      if (found == 1)
          printf("%d\n",loc);
      else
          printf("-1\n");
  
      fclose(io);
  
      return 0;
  }
  </code></pre>
  
  <p>EDIT: It's not my program. 
  I wish I knew enough C in order to fix it, but I'm on a deadline. This program is meant to find the first occurrence of a 7 digit number in the PI sequence, index.dat contains an huge array number => position.</p>
  
  <p><a href="http://jclement.ca/fun/pi/search.cgi" rel="nofollow noreferrer">http://jclement.ca/fun/pi/search.cgi</a></p>
  
  <p>EDIT 2: I've used the updated code with the test for null pointer, still getting the same results.
  The program is working fine on my local machine, this error only happens on the server.</p>