title: C program in Linux to read a file descriptor passed as a terminal argument
body: <p>I've been looking into different discussions how to get the open file descriptors for a current process on Linux from a c program, but could not find the following example:</p>
  
  <pre><code>./sample 4&lt;/some_file 5&lt;some_other_file
  </code></pre>
  
  <p>Is there any way to get those file descriptors in a <code>sample.c</code> program in this case. I found out that those redirections are not treated as command line arguments. Hope someone can help.</p>
  
  <p>Ofcourse fds 4 and 5 are given just as example, I would like the program to find out which fds were open on execution.</p>