Read integers from a text file with C++ ifstream
<p>I want to read graph adjacency information from a text file and store it into a vector.</p>

<ul>
<li><p>the file has arbitrary number of lines </p></li>
<li><p>each line has arbitrary number of integers ended with '\n'</p></li>
</ul>

<p>for example,</p>

<pre><code>First line:
0 1 4
Second line:
1 0 4 3 2
Thrid line:
2 1 3
Fourth line:
3 1 2 4
Fifth line:
4 0 1 3
</code></pre>

<p>If I use getline() to read one line at a time, how do I parse the line (as each line has variable number of integers)?</p>

<p>Any suggestions? Thanks in advance.</p>
