I was wondering what the most efficient way of reading a directory of files line by line into an array was. My task is to search a directory for files that end with a certain extension and read each line of that file would should contain only integers on each line into a single dimension array. Then move onto the next file and add each line of that file to the existing array. I was looking at reading a text file into an array in c and was thinking I could modify Johannes' example to fit my scenario. Thanks in advance.
Edit:
Apologies guys when I said efficient I was in terms of memory allocation. Also it does have to be in c. I have added the homework tag and and shall research the man pages on glob. Will report back.