Getting a string off a .txt file into a Vector
<p>I am trying to write program that takes strings stored in a vector, and then adds them to a .txt file, and then if I want fill a vector with the strings that are saved on to the .txt file and let me print them out. </p>

<p>But when I tried to do it, it said that the vector had not been filled, ifstream and >> not work with loading strings into a Vector.</p>

<pre><code>int main()
{
    vector&lt;string&gt; champ_list;
    vector&lt;string&gt; fri_list;
    string champ_name;
    string list_name;
    string champ_again;
    cout &lt;&lt;"Pleas enter in the name of the list for your Random pick\n"; 
    cin&gt;&gt;list_name;

    do
    {
        cout &lt;&lt;"Please enter in the name of the champion you would like to add to the list\n";
        cin&gt;&gt;champ_name;
        champ_list.push_back(champ_name);
        cout &lt;&lt;"Would you like to add another name to the list y/n\n";
        cin&gt;&gt;champ_again;
    } while(champ_again == "y");
    cout &lt;&lt;"1\n";

    ofstream mid_save("mid.txt");
    mid_save&lt;&lt;champ_list[0]&lt;&lt;"\n";
    cout &lt;&lt;"2\n";

    // This is where the program crashes 
    ifstream mid_print("mid.txt");
    mid_print&gt;&gt;fri_list[0];
    cout&lt;&lt;"3\n";

    cout &lt;&lt;fri_list[0];
    cin&gt;&gt;list_name;

    return 0;
};
</code></pre>
