On Feb 16, 2007, at 2:28 PM, Kevin Windham wrote:

On Feb 16, 2007, at 3:18 PM, Charles Yeomans wrote:

InStrB returns 0 if no match is found, so this loop will never terminate. Instead --
        

Dim f As FolderItem = GetFolderItem(filePath, FolderItem.PathTypeShell)
        // check for bad f instance
        Dim fs As TextInputStream = f.OpenAsTextFile
        // check for nil fs
        theFileString = fs.ReadAll
        dim matchStringLength as Integer = LenB(matchString)
        Dim keyOffset As Integer = 1
        Do
                keyOffset = InStrB(keyOffset, theFileString, matchString )
                if keyOffset > 0 then
                  // Process located data
                  keyOffset = keyOffset + matchStringLength
                else
                  exit
                end if
        Loop

Tim,

Since encodings shouldn't matter in this case since it's binary data, I would use a binary stream and be sure to use the "B" version of InStr and related calls as Charles used here. That should be faster.

So I can assign a binary stream to a string property? The parse will be definitely faster the larger the input file. I'll give that a shot.

Thanks,

Tim
--
Tim Jones
[EMAIL PROTECTED]

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to