You still aren't allocating anything for each row. You'll have to do that in 'fillAry' I suppose. Something like:
Code:
void fillAry( char ** yourlist, size_t numrows )
{
char buf[BUFSIZ] = {0};
FILE *fp;
size_t row = 0;
fp = fopen( "yourfile", "r" );
while( fgets( buf, BUFSIZ, fp ) != NULL && row < numrows )
{
size_t len = strlen( buf );
yourlist[ row ] = malloc( len );
strncpy( yourlist[ row ], buf, len - 1 );
}
}
That looks about right. Potentailly a few minor annoying bugs, since I didn't do any error checking, but I'll leave that up to you. Oh, and you really should call free for each row of your array when you're all done. Plus you'll have to free the whole works then too. Oh, and close your file when you're done with it.
[edit]
Oh, and if you want to see if it's reading correctly, just do a quick run through:
Code:
void readfile( void )
{
char buf[BUFSIZ] = {0};
FILE *fp;
fp = fopen( "yourfile", "r" );
while( fgets( buf, BUFSIZ, fp ) != NULL )
{
printf("This buffer contains: %s\n", buf );
}
fclose( fp );
}
Again, do some error checking.
[/edit]
Quzah.