title: My realpath return null for files
body: <p>I begin in C and i need to use the function realpath but i havn't find many exemple. I helped myself of it : <a href="https://stackoverflow.com/questions/1583873/casting-issue-with-realpath-function-c-programming">link</a>.
  My current problem is that my function works for a folder but realpath return null when it's a file.</p>
  
  <pre class="lang-c prettyprint-override"><code> while ((dir = readdir(rep)) != NULL)
      {
          if ( !strcmp(dir-&gt;d_name, ".") || !strcmp(dir-&gt;d_name, "..") )
              {
                  // do nothing (straight logic)
          } else {
              char buf[_POSIX_PATH_MAX];
              char *path;
              path = realpath(dir-&gt;d_name, buf);
              if (!path)
              {
                      perror("realpath");
                      exit(EXIT_FAILURE);
              }
      }
  </code></pre>
  
  <p>EDIT : The purpose of my function is to have any absolute realpaths for files and folders in the folder dir</p>