Type casting pointer when writing to binary file in C++
<p>Today in CS 111 class my instructor ended with a 'brief' look at writing structures to binary files. I say brief because he just included it as a kind of aside, saying it would not be on the final. Problem is, I don't fully understand what's going on in the program example and it is bothering me. Hopefully somebody will take the time to explain it to me. The code is as follows:</p>

<pre><code>#include &lt;iostream&gt;
#include &lt;fstream&gt;
using namespace std;

struct PayStub
{
    int id_num;
    bool overtime;
    float hourly_rate;
};

int main()
{
    PayStub info = {1234, false, 15.45};

    ofstream data_store;

    data_store.open("test.cs111", ios::binary);

    char *raw_data = (char*)&amp;info;
    data_store.write(raw_data, sizeof(PayStub));

    data_store.close();

    return 0;

}
</code></pre>

<p>I don't understand what is going on specifically in the statement <code>char *raw_data = (char*)&amp;info;</code> and why it is necessary. I understand a pointer to a char is being declared and initialized, but what exactly is it being initialized to, and how is that being used in the next line?
I hope this isn't a stupid question. Thanks in advance for your help.</p>