pctroll pctroll - 2 months ago 13
C++ Question

How can I know the type of a file using Boost.Filesystem?

I'm using Boost but I cannot find complete (or good) documentation about the filesystem library in the installation directory nor the web. The "-ls" example I found has been quite a helper but it's not enough.

Thanks in advance :)

Answer

How about:

http://www.boost.org/doc/libs/1_39_0/libs/filesystem/doc/index.htm

The functions for figuring out the file type (directory, normal file etc.) is found on this subpage: http://www.boost.org/doc/libs/1_39_0/libs/filesystem/doc/reference.html#file_status

If you are looking for the file extension check out: template <class Path> typename Path::string_type extension(const Path &p); on the page: http://www.boost.org/doc/libs/1_39_0/libs/filesystem/doc/reference.html#Convenience-functions