C only.

First em I on the right track? I am just trying to read line by line and store each line into a char**.
It works, but maybe I missed something MUCH simpler.

PHP Code:
 char ***ppNames// <-- this is a parameter for the function thats why you see the extra dereference

  //Begin reading the file
  
int iLine 0;
  while (!
feof(pFile)) {
    
//Read in the name
    
char pName[255];
    
fgets(pName255pFile);
    
char *pNewLinePos strrchr(pName'\n');
    if (
pNewLinePos != NULL) {
     (*
pNewLinePos) = '\0';
    }

    
//Reallocate and zero the new memory
    
(*ppNames) = (char**)realloc((*ppNames), (iLine+1) * (sizeof(char**)));
    
memset((*ppNames)+iLine0sizeof(char*));
    
    
//Reallocate a new char pointer
    
(*ppNames)[iLine] = (char*)realloc((*ppNames)[iLine], strlen(pName));

    
//Copy in the name into the char array
    
strcpy((*ppNames)[iLine], pName);    

    
//Next Line
    
iLine++;
  } 

Second, I am trying to free the array of char* and em getting errors:
PHP Code:
  for (0iSizei++) {    
    
free(*(ppNames+i)); //Causes error, invalid pointer deletion
    
free(ppNames+i); //Works fine
  

Any advice?