file.open()

I'm trying to run a bunch of text files through some code I wrote. The function passes in a string filename, and then I try to open it with:

inFile.open(filename);

unfortunately it tells me there is
no matching function for call to 'std::basic_ifstream<char>::open(std::string&)'
It seems that I can only have a constant in there?

Can anyone tell me away to get around this please?
inFile.open(filename.c_str());
oh yeah. thanks.
Anyone know why there isn't an overload? That's downright weird. I mean, it would be such a tiny function to write.
Topic archived. No new replies allowed.