Reading space separated integers into an array in C++
<p>Total beginner's question here, any help much appreciated:</p>

<p>I have a .txt file of numbers (in this case all less than 100) separated by spaces, in rows separated by new lines. Something like this:</p>

<pre><code>   41 53 07 91 44
   52 17 13 03 21
</code></pre>

<p>etc.</p>

<p>I would like to read these numbers into a 2d array, exactly as they appear, so that spaces separate columns of the array, and new lines separate rows. I imagine this is easy for someone who knows what they're doing, but I'm having trouble getting it to work. I can get it to read the lines in as strings, but then I'm having trouble separating out individual numbers, and getting it to treat them as integers.</p>

<p>Thanks to anyone who can give me an idea.</p>
