title: How to determine the size of (all the content) a file so I can allocate memory for it at once?
body: <p>I am trying to allocate memory for the content of a file with words(separated by: \n).</p>
  
  <p>How do I replace the 16000 to make it usable with files of greater size?</p>
  
  <p>My code:</p>
  
  <pre><code>typedef struct node {
      bool is_word;
      struct node* children[27];
  } node;
  
  node* root;
  
  
  bool load(const char* dictionary)
  {
      FILE *fp;
      fp = fopen(dictionary, "rb");
  
  
      node* node_bucket = calloc(16000, sizeof(node));
      node* next_free_node = node_bucket;
  
      // compute...
  
      // to later free the memory with another function
      root = node_bucket;
  }
  </code></pre>
  
  <p>Thanks</p>