File not reading properly C++ ifstream
<p>I have an application where I'm using ifstream to read the file. 
I have 1000 numbers in the file in each line. My application should read all these lines. </p>

<p>But when I have the number of lines less than 800 it is showing the count as 0
why is it like this. 
The code is below.</p>

<pre><code>int tmp, count=0,ucount=0; 

ifstream fin("rnum.txt");
while(fin &gt;&gt; tmp)
{
    count++;
}
cout&lt;&lt;"showing count: "&lt;&lt;count&lt;&lt;endl;
ucount=count;
fin.open("rnum.txt");
int i=0;
cout&lt;&lt;"Before entering loop"&lt;&lt;count&lt;&lt;endl;
while(fin &gt;&gt; tmp){
    iArray[i++]=tmp;
}
</code></pre>

<p>When I read a file with 1000 lines it is only reading 720 lines too. I don't understand why its reading like this.</p>

<p>Is there anything wrong in the code. </p>

<p>My requirement is to take the number of lines COUNT to the ucount variable.</p>
