boost::filesystem Open all files in directory

I'm having trouble getting this to work, I've been beating my head against the wall for about two or three days now, reading through the boost docs and whatnot, and having absolutely no luck with it. What I'm trying to do is recursively open every file in a save/ directory, and read in a new class to a vector.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
void characterSet::openChars(){
    vector<boost::filesystem::path> v;
    vector<boost::filesystem::path>::iterator iter;
    const boost::filesystem::path p("save/");
    try{
        if(exists(p) && is_directory(p)){
            copy(boost::filesystem::directory_iterator(p), boost::filesystem::directory_iterator(), back_inserter(v));
            sort(v.begin(), v.end());
            for(iter = v.begin(); iter != v.end(); ++iter){
                myOpenFile.open(iter->filename()); //This line is broken
                it = characters.begin();
                while(!myOpenFile.eof()){
                    myOpenFile >> name;
                    for(int i = 0; i < 9; i++){
                        myOpenFile >> tempInt;
                        x.push_back(tempInt);
                    }
                tempChar = new character(name, x);
                cout << "Successfully loaded " << tempChar->charName << endl;
                characters.push_back(tempChar);
                x.clear();
                }
                myOpenFile.close();
            }
        }
        else {cout << p << "does not exist.\n";}
    }
    catch(const boost::filesystem::filesystem_error& ex){
        cout << ex.what() << "\n";
    }
}


The problem I'm getting is that the compiler throws an error to me:
/home/*****/Documents/OOP/*****/main.cpp||In member function ‘void characterSet::openChars()’:|
/home/*****/Documents/OOP/*****/main.cpp|143|error: no matching function for call to ‘std::basic_ifstream<char, std::char_traits<char> >::open(boost::filesystem3::path)’|
/usr/include/c++/4.4/fstream|525|note: candidates are: void std::basic_ifstream<_CharT, _Traits>::open(const char*, std::_Ios_Openmode) [with _CharT = char, _Traits = std::char_traits<char>]|
||=== Build finished: 1 errors, 0 warnings ===|


For some reason that I can't tell, I can't get the file to compile. I think it's a typecast issue, and I tried using stringstream to fix it, but that didn't work out well. Everything past the commented line has been tested independently to work. Any other ideas?
Unfortunately filesystem is not good documented.

open expects a c string while filename() returns (from what I've read) a std::string. So you have to write myOpenFile.open(iter->filename().c_str());
Tried that already. I get major compile-time explosions, and the compiler points to the header files being wrong. I don't think that would be it.
Yes, the documantion i've read stated that the return type is 'string_type'. But from the error it looks like it returns 'path'. Then you have to write myOpenFile.open(iter->filename().string().c_str());
Either of your suggestions returns the same error sequence, actually.
If it helps any, I tried using
1
2
3
ostringstream fileName;
fileName << iter->filename();
myOpenFile.open(fileName.str().c_str());

And I got
main.cpp|| undefined reference to `boost::filesystem3::path::filename() const'|
Topic archived. No new replies allowed.