What is the C++ equivalent of PHP’s is_dir() ?
http://www.php.net/manual/en/function.is-dir.php
bool is_dir ( string $filename )
Tells whether the given filename is a directory.
Working on a Linux platform only, what library would you use?
And what if cross-platform support mattered, what method would you use?
The POSIX function
lstat(and its less secure friendstat) returns astructthat you can query for that information. A convenience macro is provided:S_ISDIR()man 2 lstatfor usage information.Boost also provides the filesystem library, which provides an easy-to-use set of functions, including the free function
is_directory().