title: Iterating through a directory of files and reading each line into an array
body: <p>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 <a href="https://stackoverflow.com/questions/410943/reading-a-text-file-into-an-array-in-c">reading a text file into an array in c</a> and was thinking I could modify Johannes' example to fit my scenario. Thanks in advance.</p>
  
  <p>Edit:</p>
  
  <p>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. </p>