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

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

Caught that one myself. Since I'll always be starting at the 5th byte and moving forward, I look for the 0 result from InStrB as the termination of the run.

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

That's also a great tip - I was only moving forward one as the matchstring is 8 bytes, but why re-read bytes that we've already read?.

Thanks again.

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