CStringCompare Returns An Error When Comparing Two Identical Strings in LabWindows/CVI Primary Software: LabWindows/CVI Development Systems>>Full Development SystemPrimary Software Version: 8.0 Primary Software Fixed Version: N/A Secondary Software: LabWindows/CVI Development Systems>>Base Package
Problem: I am trying to use the ListFindItem function in LabWindows/CVI to search for a string in a List. In particular, I am using CStringCompare as the search function. The ListFindItem function fails to find strings that are present in my List. Why am I seeing this incorrect behavior, and how can I correct it?Solution: The CStringCompare function will perform a strcmp comparison on your search string and on each string in your List. Due to how the search string is dereferenced and passed to the strcmp function, your search string must be a pointer instead of an array of characters for the ListFindItem function to return correct results.An example of how to use the ListFindItem and CStringCompare functions is shown below:Note: If you pass an array of characters as your search string, the ListFindItem function will either not find the string in your List, or it will thrown a General Protection Fault fatal run-time error. Related Links: Attachments:
Report Date: 03/07/2006 Last Updated: 03/08/2006 Document ID: 3V6FBIK7 |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
