From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

About the List data type.

I found even if not create the list, the function ListNumItems() can still return back a zero. This will make a confusing because the return value cannot instruct an error of that the list has not been created.

 

David

0 Kudos
Message 1 of 2
(4,137 Views)

You can use the toolbox macro VALIDATE_LIST (list) before trying to access the list. The macro is defined in toolbox.h and returns 0 if the list passed is not a valid one. See the code for ListNumItems in toolbox.c file.

 

Having said this, that function could be modified so that it returns -1 in case the list is not valid instead of 0, which is a valid return value for the function. You can modify it on your own and recompile the toolbox library.



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 2 of 2
(4,129 Views)