Determining the correct size for a C++ array
<p>I need to be able to set the size of an array based on the number of bytes in a file.</p>

<p>For example, I want to do this:</p>

<pre><code>// Obtain the file size.
    fseek (fp, 0, SEEK_END);
    size_t file_size = ftell(fp);
    rewind(fp);

// Create the buffer to hold the file contents.
    char buff[file_size];
</code></pre>

<p>However, I get a compile time error saying that the size of the buffer has to be a constant.</p>

<p>How can I accomplish this?</p>
