title: Determine file type in C
body: <p>I am working on a program in C on a linux machine that displays the file type of a file presented as an argument to the program. The program needs to determine if a file is any one of the following: directory, device, (regular) file, link, socket, or fifo. I am not exactly sure how to determine file type.</p>
  
  <p>Here is my code thus far (not much): </p>
  
  <pre><code>int
  main(int argc, char **argv)
  {
      if( argc == 1 )     /* default: current directory */
          puts("Directory");
      else
          while( --argc &gt; 0 )
              determine_ftype(*++argv);
  
      return  0;
  }
  </code></pre>
  
  <p>Thanks!</p>