Unexpected number of values when reading integers from a text file
<p>I am reading integers from text file into an <code>int</code> array, so I use the following code. But it does not seem to read in the expected number of integers:</p>

<pre><code>string fileContent = File.ReadAllText("D:\\pixels.txt");
TextWriter tw = new StreamWriter("D:\\print.txt");
string[] integerStrings = fileContent.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
int[] integers = new int[integerStrings.Length];
for (int n = 0; n &lt; integerStrings.Length; n++)
{
    integers[n] = int.Parse(integerStrings[n]);
    tw.Write(integers[n]+" ");
}
tw.Write(integers.Length+" "+integerStrings.Length+" ");
</code></pre>

<p>In the file (tw) I get all the integers printed, but the <code>integers.Length</code> and <code>integerStrings.Length</code> are not correct. They should be 262,144 but they are both 41,616.
I cannot think of any problems.</p>
