how can I add error checking for empty string case
<p>There is error checking for a missing file or incorrectly typed file name...but for no file_name i.e. the string file_name is empty I get the error</p>

<blockquote>
  <p><code>terminate</code> called after throwing an instance of <code>'std::logic_error'</code></p>
</blockquote>

<p>and then windows throw an error at me as well.</p>

<p>My guess would be to add a check for the empty string... at file_name.str() before creating an instance of type ifstream...but just wanted to check.</p>

<pre><code>void file_to_string(string file_name)
{
    string line;  
    ifstream myfile(file_name.c_str());
    if (myfile.is_open())
    {
        while (myfile.good())
        {
            getline(myfile, line);
            cout &lt;&lt; line;
        }
        myfile.close();
    }
    else
    {
        cout &lt;&lt; "File : " &lt;&lt; file_name &lt;&lt; " : did not open";
    }
}

int main(int argc, char* argv[])
{
    file_to_string(argv[1]);
}
</code></pre>
