0xC0000005: Access violation writing location
<p>I have this function for reading text from files:</p>

<pre><code>uintmax_t ResourcePack::getText(const string&amp; file, char** data)
{
    *data = new char[static_cast&lt;size_t&gt;(size) + 1];
    fseek(_fileDescriptor, static_cast&lt;long&gt;(begin), SEEK_SET);
    fread(*data, static_cast&lt;size_t&gt;(size), 1, _fileDescriptor);
    *data[size] = '\0';
}
</code></pre>

<p><code>FILE* _fileDescriptor, uintmax_t size</code> and <code>uintmax_t begin</code> are get in other code, not important here, but with correct values.</p>

<p><code>fseek</code> and <code>fread</code> lines work fine.
Actually, I have the file content in *data, but when the last line is executed, I got the access violation.</p>

<p>Why I can write into <code>*data</code> using <code>fread</code>, but not <code>using *data[size] = '\0'</code>?</p>
