Reading list of objects from binary file
<p>I am currently building a custom binary file for a huge list of data which will be representing some angle of movements in a game. Although i am running into a wall when trying to find a way to write all the datapoints and then reading them into a huge array or vector.</p>

<p>Here is how i constructed my fileformat:</p>

<pre><code>class TestFormat {
    public:
        float   x;
        float   y;
        float   z;
};
</code></pre>

<p>And the test code for writing and reading:</p>

<pre><code>int main()
{
    TestFormat test_1, temp;
    test_1.x = 4.6531;
    test_1.y = 4.7213;
    test_1.z = 6.1375;

    // Write
    ofstream ofs("test.bin", ios::binary);
    ofs.write((char *)&amp;test_1, sizeof(test_1));
    ofs.close();

    // Read
    ifstream ifs("test.bin", ios::binary);
    ifs.read((char *)&amp;temp, sizeof(temp));
    ifs.close();

    cout &lt;&lt; temp.x &lt;&lt; endl;
}
</code></pre>

<p>To extend this code i can just write the additional objects into the same file, but i am not sure how to load these objects back into an array afterwards.</p>