I am looping through two files line by line.
On is a large file in memory (20MB) the other is a smaller file
being read line by line from disk using
INPUT# 100,
The code starts at the top of the large file and runs thru it
untill the date and time match the small file and then it steps
both files one line at a time untill the smaller file is exhausted.
then the next small file is processed and so on.
All is working, but every time the small file is exhausted the
program hits a brick wall for a second or two (as seen in the
progress bar). This is occuring when the EOF is detected
Why?
------------------
Kind Regards
Mike
[This message has been edited by Mike Trader (edited August 22, 2001).]
On is a large file in memory (20MB) the other is a smaller file
being read line by line from disk using
INPUT# 100,
The code starts at the top of the large file and runs thru it
untill the date and time match the small file and then it steps
both files one line at a time untill the smaller file is exhausted.
then the next small file is processed and so on.
All is working, but every time the small file is exhausted the
program hits a brick wall for a second or two (as seen in the
progress bar). This is occuring when the EOF is detected
Why?
Code:
' open files etc etc ' WHILE Done = 0 ' step thru the large file dLineStr = MID$(dFileStr, SPos+2, EPos-(SPos+2)) dDateStr = PARSE$(dLineStr, 1) dDate = DateToJulian(dDateStr) dTime = TimeToMinutes(VAL(dTimeStr)) WHILE (sDate < dDate OR (sDate = dDate AND sTime < dTime)) AND NOT EOF(100) AND Done = 0 ' advance the Small file to match IF sDate = dDate AND sTime = dTime THEN EXIT LOOP ' for first line only INPUT# 100, sDateStr, sTimeStr, OpenPrice, HighPrice, LowPrice, ClosePrice ' Input a Line sDate = DateToJulian(sDateStr) sTime = TimeToMinutes(VAL(sTimeStr)) WEND IF sDate = dDate AND sTime = dTime THEN ' process the data END IF INCR LineNum : SPos = EPos : EPos = INSTR(SPos+2, dFileStr, CHR$(13)) : IF EPos = 0 THEN EXIT LOOP IF LineNum MOD 1000 = 0 THEN DIALOG SEND hDlgProgBar, %PROGBARID, ROUND(LineNum/LinesInFile*100 ,0), 0 WEND ' close small file ' loop for the rest of the small files
Kind Regards
Mike
[This message has been edited by Mike Trader (edited August 22, 2001).]
Comment