Wrong values when reading integers from file
<p>I asked a similar question some weeks ago, but I got stuck, and didn't really know if I didn't make any other mistakes. </p>

<p>I can relatively clearly tell what I am fighting with now.</p>

<p>I am trying re-write a VB6 function in C++.
The difficult line is this one:</p>

<pre><code>vector&lt;int&gt;vIntegerValues;

vIntegerValues.resize(iCountIntegers);

fseek(iReadFile, uFromBytePos * sizeof(int), SEEK_CUR);

size_t readElements = fread(&amp;vIntegerValues[0], sizeof(int), iCountIntegers, iReadFile); 
</code></pre>

<p>My VB6 version is this:</p>

<pre><code>Dim vIntegerValues() As Integer

ReDim vIntegerValues(0 To iCountIntegers)

Get #iReadFile, uFromBytePos, vIntegerValues()
</code></pre>

<p>However the C++ function fills up the integer vector with data that is not as expected.</p>

<p>For example in VB6 the first values are:
0,0,2,2,0,-2,0,-2,0,2,0,0,-2,</p>

<p>And in C++ the first values are 
131074, -131072, -131072, 131072, 0, 65534</p>

<p>Can somebody help when he sees where I go wrong?
Thank you very much.</p>

<p>ps: I don't know in advance what the size of the vector vIntegerValues will be, so please do not suggest anything with a fixed vector. This is where I would get stuck.</p>
