01-21-2009 03:47 PM
Solved! Go to Solution.
01-21-2009 04:58 PM
As far as I can understand lsearch performs a search in an unordered array of elements. If this is true, I'm afraid the short answer to your question is "no".
Both ANSI C library bsearch ( ) and Programmer's Toolbox BinSearch ( ) functions require the array to be sorted since they try to reduce searching time relying on the sort.
In any case, it seems quite easy to develop your own searching function; in the programmer's toolbox several functions are provided for comparisons that can help you in this task (CStringCompare and CStringNoCaseCompare are specific to string camparisons).
01-22-2009 01:15 PM
Roberto is correct, there is no one function to sort an unordered array in CVI (lsearch is not part of the ANSI C standard). However, you can create your own by using the qsort and bsearch methods in the ANSI C library or any of the sorting methods and the BinSearch from the Programmer's Toolbox. If you don't want your array to be sorted, you can create a function that makes a copy of the array, sorts it, then searches it and returns the results.
I filed a product suggestion to the developers to look at the possibility of including this in a later version of CVI.