Admin Production ni-theme
Current Publication

ListApplyToEach

LabWindows/CVI

ListApplyToEach

int ListApplyToEach (ListType list, int order, ListApplicationFunc callbackFunction, void *callbackData);

Purpose

Note Note  This function has been superseded by ListApplyToEachEx, which can operate on lists with more than INT_MAX elements.

This function takes a list and a callback function and calls the callback for each item in the list.

Parameters

Input
Name Type Description
list ListType Pass the list containing the items on which to call the specified callback function.
order int Specify a nonzero value or select Ascending in the function panel to traverse the items in the list from first to last.

Specify 0 or select Descending in the function panel to traverse the items in the list from last to first.
callbackFunction ListApplicationFunc Pass the callback function to call for each item in the list.

The function must have the following prototype:

int CVICALLBACK ListApplicationFunc(int index, void *ptrToItem, void *callbackData);


The callback function receives the following information when it is called:

  • The index of the list item for which the callback function is called
  • A pointer to the contents of the list item
  • The user-defined callback data specified in the callbackData parameter

If the list application function returns zero or a positive integer, the callback function continues to be called for the remaining items in the list. However, if the list application function returns a negative number, then ListApplyToEach stops and returns the negative number as its result.
callbackData void * A user–defined value passed to the callback function each time the callback function is called.

Return Value

Name Type Description
result int Returns the result of the last call to Function_To_Apply.

Additional Information

Library: Programmer's Toolbox

Include file: toolbox\toolbox.h

LabWindows/CVI compatibility: LabWindows/CVI 4.0 and later

Example

Refer to internet\pop3clnt\pop3clnt.cws for an example of using the ListApplyToEach function.