Attempting to pass string to std::ifstream as argument
<p>I'm attempting to use a string retrieved from a vector to pass a filename to ifstream for opening.</p>

<pre><code>vector&lt;string&gt; files;

//Populate vector

std::ifstream ifile(files[0] ,std::ios::binary);
</code></pre>

<p>When compiled This returns:</p>

<p>error: no matching function for call to 'std::basic_ifstream >::basic_ifstream(std::basic_string, std::allocator >&amp;, const std::_Ios_Openmode&amp;)*</p>

<p>If I attempt to convert files[0] to const char * first</p>

<pre><code>vector&lt;string&gt; files;

std::string l = files[0];
const char *p;
p = l.c_str();
std::ifstream ifile(p ,std::ios::binary);
</code></pre>

<p>The compiler returns:</p>

<p>error: 'l' was not declared in this scope</p>

<p>What am I doing wrong here? It's something basic and glaring i'm sure.</p>
