title: how to seek to the end of file to determine the file size?
body: <p>I'm trying to get file size in c programming using seek. I can't use <code>fseek</code>, stat.size nor <code>ftell</code>, there's a custom operating system UNIX in which I need to run. </p>
  
  <p>How can I find out filesize just by using seek? Is it possible? </p>
  
  <pre><code>  FILE *fd = open(argv[1], "r");
  
    if(fd == NULL)
    {
      printf("Not able to open the file : %s\n", argv[1]);
      return;
    }
  
    // Set the pointer to the end
    seek(fd, 0, SEEK_END);
  </code></pre>