title: Standard Library vs Windows API Speed
body: <p>My question is about whether or not I should use the Windows API if I'm trying to get the most speed out of my program, where I could instead use a Standard Library function.</p>
  <p>I assume the answer isn't consistent among every call; Specifically, I'm curious about stat() vs dwFileAttributes, if I wanted to figure out if a file was a directory or not for example (assuming file_name is a string containing the full path to the file):</p>
  <pre><code>WIN32_FIND_DATA fileData;
  HANDLE          hSearch;
  
  hSearch = FindFirstFile(TEXT(file_name), &amp;fileData);
  
  int isDir = fileData.dwFileAttributes &amp; FILE_ATTRIBUTE_DIRECTORY
  </code></pre>
  <p>vs.</p>
  <pre><code>struct stat info;
  stat(file_name, &amp;info);
  
  int isDir = S_ISDIR(info.st_mode);
  </code></pre>
  <p>If anyone knows, or can elaborate on what the speed difference between these libraries generally is (if any) I'd appreciate it.</p>