You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@apr.apache.org by Konstantin Sharenkov <Ko...@enterra-inc.com> on 2006/05/03 12:43:21 UTC

Check existence of file or dir

Hello

 

Is it possible in APR to check file existence without opening the file ?

I am looking for function like

apr_status_t apt_file_exists( const char* path );

You may treat this as Feature Request.

 

also I interesting to check directory existence.

 

I am interested what is best way to do these checks for now (with
current  apr_* functions ).

Konstantin Sharenkov 


Re: Check existence of file or dir

Posted by Colm MacCarthaigh <co...@stdlib.net>.
On Wed, May 03, 2006 at 05:43:21PM +0700, Konstantin Sharenkov wrote:
> Is it possible in APR to check file existence without opening the file ?

apr_stat() does what you want :)

> also I interesting to check directory existence.

Directories are files too. But you can check finfo->filetype == APR_DIR.

-- 
Colm MacCárthaigh                        Public Key: colm+pgp@stdlib.net