The following function is supposed to read the words in a file (separated by LFs) into an array of string:

Code:
int fLoadWords(char *file, char **array) {

  FILE *fp;
  char string[WORDSIZE];
  char *p;
  int i=0;

  fp = fopen(file, "r");

  while(fgets(string, WORDSIZE, fp) != NULL) {
          if ((p = strchr(string, '\n')) != NULL)
                        *p = '\0';
          strcpy(array[i], string);
          i++;
  }
  for (i=0; i < WORDS; i++)
        printf("************* Words: %i:%s ************\n", i,array[i]);

  return 0;
}
But it causes me to coredump at the strcpy.

The structure passed into array is defined as:
Code:
strWords = (char **) calloc (WORDS, sizeof (char *));
...
iErrCode = fLoadWords(strFile, strWords);
I thought about trying:
Code:
array[i] = string;
instead of the strcpy, but that doesn't work because it just points all the pointers to string.

Also, when I have a bunch of lines like:
Code:
array[0]='word1';
array[1]='word2';
etc...
it works fine, so that makes me think the struct is fine.

Help is appreciated!!

M.E.