Hi!
Just a question:
Did you run your code in debugger to see why it fails?
And an idea from the scratch, what happens if the directory found is either . or ..? May be you should skip them?
Best Regards,
Ovanes
Hello friends!
I'm trying to use directory_iterator but when I try to list recursivelly an entire drive or a big directory I get an unhandled exception.
I'm trying to figure out if I did something wrong but the code is very similar to the example on the boost web page.
Here is the code:
//-------------------------------------------------------------------
VOID CFileSearch::InternalSearch( path RootDir )
{
directory_iterator EndDirItr;
for ( directory_iterator DirItr( RootDir ); DirItr != EndDirItr; ++DirItr )
{
if ( is_regular( DirItr->status() ) )
{
_tprintf( "FILE: %s\n", DirItr->path().string().c_str() );
}
else if ( is_directory( DirItr->status() ) )
{
_tprintf( "DIR : %s\n", DirItr->path().string().c_str() );
InternalSearch( DirItr->path() );
}
}
}
//-------------------------------------------------------------------
VOID CFileSearch::Search( string RootDir )
{
path TempRootDir = system_complete( path( RootDir, native ) );
if ( exists( TempRootDir ) == true )
{
InternalSearch( TempRootDir );
}
}
//-------------------------------------------------------------------
CFileSearch FileSearch;
FileSearch.Search( "c:\\" );
Is there something wrong in the above code?
Thank you in advance.
Silvio.
_______________________________________________
Boost-users mailing list
Boost-users@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users