title: check if something exists and is executable in C, using stat function
body: <p>For example, I have directory a and b under my current working directory. I'm trying to locate file X, how can I modify the <code>stat()</code> command so that it checks both directory a and b instead of just current working directory? would <code>stat(a/file, &amp;buf)</code> work? also, to check if it's executable, I know the code is <code>buf.S_IXUSR</code>, does <code>if (buf.S_IXUSR)</code> work?</p>
  
  <p>thanks!</p>