Boost logo

Boost Users :

Subject: [Boost-users] Problem Iterating a directory
From: Sarma Tangirala (tvssarma.omega9_at_[hidden])
Date: 2013-06-25 20:56:26


Hello,

I am using boost filesystem to iterate through my directory and have
encountered a problem that I am unsure of how to debug.

  try {

    //for ( boostfs::directory_iterator
dir(boostfs::path("/home/vtangira/Desktop/person_finder_v20130513/data/dummy1")),
end_itr;
    for ( boostfs::directory_iterator
dir(boostfs::path(paths_to_files.at(0).c_str())),
end_itr;
          dir != end_itr;
          dir++
        ) {

        std::cout << "File: " << dir->path() << std::endl;
    }

  } catch (boostfs::filesystem_error e) {
      cout << "Error Code: " << e.code() << endl
             << "Error Msg: " << e.code().message() << endl;
    }

In this snippet, the line with the for loop that has been commented out
works but the the one below it with the vector does not. The vector version
represents the same string.

Any advice is appreciated.

Thanks

-- 
0 1 0
0 0 1
1 1 1


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net