Can't Declare a Variable Char[]
<pre><code>struct Movie
{
    char* date;
    char* title;
    char* rating;
    int runtime;
};

typedef Movie* moviePtr;
moviePtr tempDB;

bool doStuff()
{
//... snip .,,
    tempDB = new Movie[tempC];
    int i;

    ifs &gt;&gt; temp;
    while(ifs.good() &amp;&amp; i &lt; tempC)
    {
        tempDB[i].date = new char[strlen(temp)+1];
        strcpy(tempDB[i].date, temp);
//... snip ...

}
</code></pre>

<p>When I run that, I get a segmentation fault (on line tempDB[i].date = new char[strlen(temp)+1]; I debugged it)</p>

<p>tempC is how big the array should be, read from the file.</p>

<p>What have I done wrong :(</p>
