LabWindows/CVI

Ini_New

IniText Ini_New (int automaticSorting);

Purpose

Creates an object that can contain an in-memory list of tag/value pairs within sections. You can complete the following:

Since this instrument driver has not been implemented with any multithread-safe locking, National Instruments recommends that you do not share the same .ini object among multiple threads. You can have multiple .ini objects among multiple threads as long has no single .ini object is shared among the threads.

This function allows you to choose whether the in-memory list is automatically sorted. Refer to the help for the automaticSorting parameter for information about how automatic sorting affects performance.

By default, each time you add an object to the in-memory list using one of the Ini_Put functions, a check is made for items with the same name. This can prevent unwanted duplicates, but it also can slow performance. You can disable this feature using the Ini_SetDuplicateChecking function.

Parameters

Input
Name Type Description
automaticSorting int Pass a non-zero value or select Yes in the function panel to maintain the in-memory list of tag/value pairs in sorted order.

The sorting is based on section name and tag name within section name. The sorting is case-insensitive.

Pass 0 or select No in the function panel to maintain the order in which the sections and tags were created or read from the file.

You can dynamically change the sorting mode by calling Ini_Sort or Ini_DisableSorting.

Effects of Sorting on Performance

Enabling sorting has the following effects on performance:

  • Getting values from the in-memory list is faster.
  • If you enable checking for duplicates (the default), adding values to the in-memory list is faster than it is for a non-sorted list.
  • If you disable checking for duplicates, adding values to the in-memory list is slower than it is for a non-sorted list. For more information, refer to the Ini_SetDuplicateChecking function.

Return Value

Name Type Description
handle IniText The handle to the object created in this function.

0 is returned if there is not enough memory.

Use this handle as the first parameter to all of the other functions in this instrument driver.

Additional Information

Library: Reading/Writing .ini-Style Files

Include file: toolbox\inifile.h

LabWindows/CVI compatibility: LabWindows/CVI 4.0 and later

Examples

Refer to the following examples that use the Ini_New function:

  • apps\uirview\uirview.cws

    Open example
  • toolbox\ini.cws

    Open example
  • toolbox\menudemo.cws

    Open example

Log in to get a better experience