how to read the formatted file in C++
<p>I have the following format. Each line has two integers and the file is ended by "*". How can I read the two numbers from the file. Thanks.</p>

<pre><code>4 5
7 8
78 89
 *  //end of file
</code></pre>

<p><strong>Edit</strong></p>

<p>I know read the two numbers but do not know how to deal with "*". If I store each number as integer type and read them by <code>cin</code>. But The last line is a string type. So the problem is that I read it as a integer but it is string, I do not how to judge whether it is * or not.</p>

<p>My code was as follows (it is obviously incorrect):</p>

<pre><code>string strLine,strChar;
istringstream istr;
int a,b;
while(getline(fin,strChar))
{
    istr.str(strLine);
    istr&gt;&gt; ws; 
    istr&gt;&gt;strChar;


    if (strChar=="*")
    {
        break;
    }
    istr&gt;&gt;a&gt;&gt;b;
}
</code></pre>
