Jump to content

Recommended Posts

Posted (edited)

The only thing I have seen was everyone recommending Randallc's TailRW.

However, his examples seem confusing and they cause AutoIT.exe to crash. I am not sure if I am doing something wrong or it's not made for Windows 7.

Either way, I am looking for something super simple, like this:

_FileReadLine($iLine)

Where if $iLine is negative, it takes the end lines. Thus: _FileReadLine(-100) retrieves the last 100 lines of a file.

If its not possible to read lines, then I would be OK with reading a number of [b/b]ytes. I am also interested in reading in the first 100 lines without loading all of them.

Please don't recommend using FileReadToArray and processing it that way. I am looking for something that can do a 5-10GB file in under 1/2 second.

Edited by ParoXsitiC
Posted

Open the file in binary mode with FileOpen() and use FileRead() to read? You can use FileSetPos() to move around in the file. Sounds right in my head ;)

You need an example?

I knew of FileOpen and FileRead, but not FileSetPos. However, this works good for bytes, but it would be preferable if I could indicate how many lines.

Posted

How big are the files you anticipate handling? If not that large

_FileReadToArray() reads the file into an array. $array[0] has the

count of lines. It may not be the fastest way to do it. But if you

screen out super huge files it may be simplest and therefore not bug

prone.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...