Read from a file. C++
<p>SO when my program starts, it attempts to read a list of products from a file. but if the file does not exist it displays an error and continue on. the problem im having is when it displays the error, it doesnt continue on to the do while loop   </p>

<pre><code>ifstream input;
    input.open("data.txt");


    if (input.fail())
    {
        cout &lt;&lt; "\n Data file not found \n";
    }
    ListItemType data; 

    input &gt;&gt; data.productname;
    while(( !input.eof()))
    {
        input &gt;&gt; data.category;
        input &gt;&gt; data.productprice;
        addproduct(head, data); 
        input &gt;&gt; data.productname;
    }

    input.close();
</code></pre>
