#include <boost/filesystem.hpp>
#include <boost/filesystem/operations.hpp>
using namespace boost::filesystem;
//文件属性
CString strPath=_T("d:\\a.txt");
wpath p(strPath.GetBuffer());
bool bIsDirectory=is_directory(p);
wstring sPath=p.wstring();
wstring sroot_path=p.root_path().wstring();
wstring sleaf=p.leaf().wstring();
wstring sfilename=p.filename().wstring();
wstring sExtension=p.extension().wstring();
CString str;
str.Format(_T("bIsDirectory = %d \npath= %s \nsExtension= %s \n sroot_path= %s \n sfilename= %s \nsleaf= %s"),
bIsDirectory,
sPath.c_str(),
sExtension.c_str(),
sroot_path.c_str(),
sfilename.c_str(),
sleaf.c_str());
AfxMessageBox(str);
//遍历目录所有文件
directory_iterator diend;
for (directory_iterator pos("d:\\");pos!=diend; ++pos)
{
wpath p=pos->path();
wstring s=p.wstring();
CString str;
str.Format(_T("%s %d"),s.c_str(),is_directory(p));
AfxMessageBox(str);
}