title: Get owner's access permissions using C++ and stat
body: <p>How can I get the file owner's access permissions using stat from sys/stat.h using C++ in Kubuntu Linux?</p>
  
  <p>Currently, I get the type of file like this:</p>
  
  <pre><code>  struct stat results;  
  
    stat(filename, &amp;results);
  
    cout &lt;&lt; "File type: ";
    if (S_ISDIR(results.st_mode))
      cout &lt;&lt; "Directory";
    else if (S_ISREG(results.st_mode))
      cout &lt;&lt; "File";
    else if (S_ISLNK(results.st_mode))
      cout &lt;&lt; "Symbolic link";
    else cout &lt;&lt; "File type not recognised";
    cout &lt;&lt; endl;
  </code></pre>
  
  <p>I know I should use t_mode's file mode bits, but I don't know how. <a href="http://opengroup.org/onlinepubs/007908775/xsh/sysstat.h.html" rel="nofollow noreferrer">See sys/stat.h</a> </p>