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?
ReadFile Smokes!
Moderators: JRL, Dorian (MJT support)
- tony_smith
- Pro Scripter
- Posts: 70
- Joined: Wed May 14, 2003 8:25 pm
- Location: Vancouver BC Canada