|
-
Jan 20th, 2000, 01:19 AM
#1
Thread Starter
Junior Member
I posted a question a week ago about comparing 2 huge lists and getting the difference. One of the suggestions was to use a Collection. It worked and it was 20 times faster than what I had. The problem is that it only finds 8 matches when there are about 10,000 matches. The lists are file name with paths:
c:\autoexec.bat
c:\winnt\calc.exe
...
The matches that it finds are in the root directory ( c:\autoexec.bat , c:\config.sys and so on) Once it hits subfolders it fails to find a match. I did an LCase() on the variable before I add it to the collection. And I did the same to the variable to be compared. So all the data is in lower case. Yet it still can't find all the matches. Here are some snippets from the program:
Public OrjFN As New Collection
.
.
.
Open "c:\OrjNT.txt" For Input As #1
Line Input #1, A$
A$ = LCase$(A$)
OrjFN.Add A$, A$
Close #1
.
.
.
Open "c:\lclfil.txt" For Input As #1
Do
Fnd = 0
Line Input #1, TmpFN
TmpFN = LCase$(TmpFN)
sDummy = OrjFN.Item(TmpFN)
bFound = (Err = 0) 'Err=0 when item found in collection
If bFound Then
Err.Clear
Fnd = 1
End If
If Fnd = 0 Then 'not foud so add it to the list
ServerF.AddItem (TmpFN)
End If
Loop Until EOF(1)
Close #1
I tried to output the contents of the collection to a file, and it was correct.
Am I doing something wrong here?
Is there a limit on the length of the string that can be added to the collection?
------------------
Joe Handal
Workstation Engineer
[email protected]
-
Jan 20th, 2000, 04:32 AM
#2
I don't know what the problem is except to suggest that you should explicitly Dim all your variables if you have not already done so. Also I just created a collection that contained a 300+ character string variable and was able to find it when I looked for it by the same key. If you want to send me your code (and sample data files), I'll take a look at it when I get a chance.
------------------
Marty
Can you buy an entire chess set in a pawn shop?
-
Jan 20th, 2000, 04:58 AM
#3
Thread Starter
Junior Member
Found the problem. Instead of checking the error number, I checked if sDummy = TmpFN, and that fixed it.
Thanks
------------------
Joe Handal
Workstation Engineer
[email protected]
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|