Results 1 to 2 of 2

Thread: Read a text file from bottom to top??

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    May 2002
    Posts
    142

    Read a text file from bottom to top??

    I need to read a long text file from the bottom to the top. (ie I need to read the last line first and then the second to last line....etc) Is there any optimized code out there to do this?

    Thanks,
    Bebandit

  2. #2
    I wonder how many charact
    Join Date
    Feb 2001
    Location
    Savage, MN, USA
    Posts
    3,704
    HOw big are the text files?


    I could think of a few ways to do this... the performance of the chosen method really hinges on what else needs to be done, how big the files are...etc.

    You could just you a seekable stream and keep moving back one byte a time...

    You could load the contents of a text file into an array using split, then reverse the array...

    a host of about 3 other options too...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width