View Single Post

  #1 (permalink)  
Old 10-12-2004
deko
 
Posts: n/a
Default file vs. fgets - performance question

I have a large file that I need to put into an array - but I only need the
last hundred or so lines. The file is approx. 1100 lines total (20k). Is
it more efficient to use fgets in a situation like this? I'm wondering if
it's quicker to read into the array only the lines I need (fgets), rather
than converting the whole file into an array (file). Or is file quicker
since I don't need fopen?


Reply With Quote