The MASM Forum Archive 2004 to 2012

General Forums => The Workshop => Topic started by: Danesh on January 20, 2007, 05:07:15 AM

Title: BinSearch
Post by: Danesh on January 20, 2007, 05:07:15 AM
Hi all,

I need a binary search function which supports searching in both strings and DWORD number arrays. Actually, I have my own binary search functions, but I prefer to use BinSearch function in MASM32 Lib but I am not sure if supports searching withing a DWORD array or only string arrays. Besides, some input parameters like

4. lpSubStr The address of the sub string to search for.

5. lnSubSt The length of the sub string

are unclear to me. I could not find any sample code in example codes. Have you any sample code or tip to help me how to use it for both strings and DWORDs arrays?

Thanks,

D.
Title: Re: BinSearch
Post by: hutch-- on January 20, 2007, 02:22:42 PM
Danesh,

The BinSearch algo is designed to search any sequence of data you point at it. It uses a length to test for and does not depend on there being an ascii zero as a terminator. Now with a DWORD array, you would probably do an array scan looking at each value to search for any partiular value and this will be faster than a BYTE level scanner like BinSearch.