Article Discussion
Wild-card Searches of Unix Directories with Random-Access Iterators
Summary: STL meets glob(): Power, robustness, and genericity without sacrificing efficiency.
2 posts.
The ability to add new comments in this discussion is temporarily disabled.
Most recent reply: April 15, 2005 0:58 AM by Matthew
    Chuck
     
    Posts: 32 / Nickname: cda / Registered: February 11, 2003 0:06 PM
    Wild-card Searches of Unix Directories with Random-Access Iterators
    September 12, 2004 8:00 PM      
    STL meets glob(): Power, robustness, and genericity without sacrificing efficiency.

    http://www.artima.com/cppsource/randomdirectories.html
    • philip
       
      Posts: 1 / Nickname: philip11 / Registered: April 11, 2005 7:54 PM
      Re: Wild-card Searches of UNIX Directories with Random-Access Iterators
      April 11, 2005 11:57 PM      
      can tell me what do you need or what does it means
      bazokaa
      • Matthew
         
        Posts: 20 / Nickname: bigboy / Registered: June 14, 2004 10:43 AM
        Re: Wild-card Searches of UNIX Directories with Random-Access Iterators
        April 15, 2005 0:58 AM      
        > can tell me what do you need or what does it means
        > bazokaa

        Hi Philip. Sorry about the delay in replying, but Artima's automatic watch notification email system's been a bit flighty of late.

        Basically, the article describes a mapping between the UNIX glob() file search function and the STL Random-Access Iterator concept, in the form of the ::unixstl::glob_sequence STL-like pseudo container. (UNIXSTL is a sub-project of STLSoft (http://stlsoft.org/) containing adaptation of UNIX APIs to the STL.)

        You can use it as you would any other STL container, in order to process search results via standard algorithms, e.g. the following deletes all the .tmp files from /tmp/junk


        ::unistl::glob_sequence matches("/tmp/junk/", "*.tmp");

        ::std::for_each(matches.begin(), matches.end(), ::remove);


        Hope that helps. :-)