C check if file exists, including on PATH

Posted by Gary on Stack Overflow See other posts from Stack Overflow or by Gary
Published on 2010-04-27T05:26:07Z Indexed on 2010/04/27 5:33 UTC
Read the original article Hit count: 292

Filed under:
|
|

Hi,

Given a filename in C, I want to determine whether this file exists and has execute permission on it. All I've got currently is:

if( access( filename, X_OK) != 0 ) {

But this wont search the PATH for files and will also match directories (which I don't want). Could anyone please help?

© Stack Overflow or respective owner

Related posts about c

    Related posts about files