title: C using scanf() on Strings
body: <p>Basically I want to scanf "strings" from a text file and pass them through to another method (that does array stuff). <strong>The current method I have works</strong>, but because I don't know the size of the potential input, I have to allocate a ridiculous amount of memory for any sized string (repeating this free and allocating process until there are no more items to be read)
  Is there a more eloquent solution to what I already have?</p>
  
  <pre><code>int main(void) {
  char *item;
  item = emalloc(100000 * sizeof *item);
  flexarray my_flexarray = flexarray_new();
  
  while (1 == scanf("%s",item)) {
      flexarray_append(my_flexarray, item);
      free(item);
      item = emalloc(100000 * sizeof *item);
  }
  free(item);
  
  flexarray_print(my_flexarray);
  flexarray_free(my_flexarray);
  return EXIT_SUCCESS;
  }
  </code></pre>