WvStreams
wvdiriterex.cc
00001 /*
00002  * A WvDirIter example.
00003  *
00004  * Takes a directory on the command line, and
00005  * prints everything it sees.
00006  *
00007  */
00008 
00009 #include "wvdiriter.h"
00010 
00011 int main()
00012 {
00013     WvString dirname(".");
00014     // or WvString dirname("/home/user/");
00015     // dirname contains the directory you want to list
00016 
00017     bool     recurse = false;
00018     // If true, do recursively
00019 
00020     WvDirIter i( dirname, recurse );
00021 
00022     for( i.rewind(); i.next(); ) {
00023         printf( "%s \n", (const char *) i->fullname);
00024     }
00025     // prints something like:
00026     // ./a.txt
00027     // ./b.txt
00028     // ./c.txt
00029 
00030     return( 0 );
00031 }