ReadFile Smokes!

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
User avatar
tony_smith
Pro Scripter
Posts: 70
Joined: Wed May 14, 2003 8:25 pm
Location: Vancouver BC Canada

ReadFile Smokes!

Post by tony_smith » Fri Feb 18, 2005 11:38 pm

Kudos to MSched developers...

I tested the new ReadFile command and found that it really makes a search routine infinitely faster than using the ReadLn/Position combination.

I tried this on a 2-Meg file (10K lines), putting the search character (An asterisk) at the end of the file...

ReadFile>U:\Test\TESTFILE.txt,result
Position>*,%result%,1,StartPos
MessageModal> Position is : %StartPos%
Remark>Try the old way
Let>LNX=0
Label>LOOP1
Let>LNX=LNX+1
ReadLn>U:\Test\TESTFILE.txt,LNX,CLINE
Remark>Character is "*"
Let>CHAR=*
Message>Looking for Char: " %CHAR% "%CRLF%In Line# %LNX%
Position>CHAR,CLINE,1,CHARPOS
If>CHARPOS>0,CHARFOUND
If>BCLINE=##EOF##,End
GoTo>LOOP1
Label>CHARFOUND
MessageModal>Character position is: %CHARPOS% in line %LNX%
Label>End

ReadFile took a second, perhaps even less to display the location of the search character. The old way took 5:10 minutes.

I use MSched a lot to search and parse files... ReadFile will make a huge difference.

I have one question; How big a file can ReadFile handle?

User avatar
support
Automation Wizard
Posts: 1450
Joined: Sat Oct 19, 2002 4:38 pm
Location: London
Contact:

Post by support » Fri Feb 18, 2005 11:52 pm

The limit is only dependent on the capabilities of your system.
MJT Net Support
[email protected]

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts