Admin Production ni-theme
Current Publication

ListInsertItem

LabWindows/CVI

ListInsertItem

int ListInsertItem (ListType list, const void *pointerToItem, ssize_t positionToInsertAt);

Purpose

This function inserts a copy of an item into a list at the specified position.

The item pointed to by pointerToItem should be the same size as the item size specified when the list was created.

Parameters

Input
Name Type Description
list ListType The list to insert the item into.
pointerToItem const void * The pointer to the item to insert.
positionToInsertAt ssize_t The position at which to insert the item. The position can be a number from 1 to the number of items in the list. Positions in the list are one-based.

To insert at the front of the list, pass -1 or the constant FRONT_OF_LIST.

To insert at the end of the list, pass 0 or the constant END_OF_LIST.

When you insert another item, the existing item at or above the specified position is moved up one position to accommodate the new item.

Return Value

Name Type Description
result int Returns non–zero if the item was inserted.

Returns zero (0) if an error occurs.

Additional Information

Library: Programmer's Toolbox

Include file: toolbox\toolbox.h

LabWindows/CVI compatibility: LabWindows/CVI 4.0 and later

Examples

Refer to the following examples that use the ListInsertItem function:

  • apps\uirview\uirview.cws

    Open example
  • TDM Streaming\tdmsReader.cws

    Open example
  • toolbox\list.cws

    Open example
  • userint\custctrl\cviogl\ogldemo.cws

    Open example
  • userint\custctrl\pathctrl\simple.cws

    Open example