Reading text file per line in C++, with unknown line length
<p>I have a text file, that is formatted somewhat like this:</p>

<pre><code>1 3 4 5 6
6 7 8
4 12 16 17 18 19 20
20
0
</code></pre>

<p>A line can contain 1 to 10000 integers. What I need to do, is read all of them line by line.</p>

<p>Pseudocode like this:</p>

<pre><code>line=0;
i=0;
while(!file.eof()){
 while(!endLine){

 array[0][i++]=file.readChar();
 }
line++;i=0;
}
</code></pre>

<p>So, I have an array , into which I would like to read every line, and each line would consist of each of these integers.</p>

<p>The problem I'm having, is how to check if the end of a line has come. </p>

<p>Note, I can't use strings. </p>

<p>Yes, This is for a homework, but the main task for the assignment is to build a tree and then transform it. I can do that, but I've no idea how to read the integers from the file.</p>
