File Opening From Filepath

Hello,
I have a problem of opening a file. The function is given as:
OntologyTree::OntologyTree(const string& ontologyFilePath)
I try to open it by the following lines:
1
2
ifstream inFile;
inFile.open(ontologyFilePath);

But I get an error:
no matching function for call to ‘std::basic_ifstream<char, std::char_traits<char> >::open(std::string&)’
/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>]

Isn't it the correct type? Any help? Thank you.
fstreams need a const char* (for some reason...I don't know why honestly). Use the .c_str() method of std::string.
Topic archived. No new replies allowed.