title: C: Reading in a file of strings into an array of char *s
body: <p>I have something like this (without the spacing issues), where I'm reading a file with strings that are separated by the <code>#</code> sign, and trying to read each of them into an array of <code>char *</code>s. However, each <code>char*</code> that holds a string much be the exact length of the string. This is a little buggy though.</p>
  
  <pre><code>char * fragments[1000];
   char temp[20];
        while (i &lt; numFrags) {
            if (fscanf(fp, "#%15[^#]#", temp) == 1) {
              char entry[strlen(temp)];
          entry = strcpy(entry, temp);
          fragments[i++] = entry;
          printf("%d\n", strlen(temp));
  
            }
        }
  </code></pre>
  
  <p>Thoughts?</p>