GetValueFromTable

IVI Library

Ivi_GetValueFromTable

Usage

ViStatus Ivi_GetValueFromTable(IviStringValueTable stringTable, ViChar string[ ], ViInt32* value);

Purpose

This function searches for a string in a string/value table and returns the value that corresponds to the string.

If the string you specify terminates with a carriage return ('\r') or newline ('\n') character, the strings in the table do not have to contain the termination character. The function considers the strings to match if the string you specify begins with the string in the table entry, followed by a carriage return, linefeed, or ASCII NUL byte.

If the function cannot find the string in the table, it returns the IVI_ERROR_INVALID_VALUE error.

Parameters

Name Type Description
stringTable IviStringValueTable

Specify the string/value table in which you want to find the string.

The ivi.h include file defines the structure of a string/value table entry as follows:

typedef struct

{
ViInt32  value;
ViString  string;
} IviStringValueEntry;

string ViChar[ ]

Specify the string you want to find in the string/value table.

If the string you specify terminates with a carriage return ('\r') or newline ('\n') character, the strings in the table do not have to contain the termination character. The function considers the strings to match if the string you specify begins with the string in the table entry, followed by a carriage return, newline, or ASCII NUL byte.

value ViInt32*

If the function finds a string/value table entry that contains the string you specify, this parameter returns the value in the entry.

If the function does not find the value in the table, the function returns the IVI_ERROR_INVALID_VALUE error code.

You can pass VI_NULL for this parameter.

Return Value

Contains the status code that the function call returns. IVI engine functions can return error and warning values from several sets of status codes. Some status codes are unique to the IVI engine. Other status codes are the same codes that VISA Library functions return. Still others are error or warning values that functions in specific instrument drivers return. Each set of status codes has its own numeric range.

Regardless of the source of the status code, 0 always indicates success, a positive value indicates a warning, and a negative value indicates an error.

Related Topic

IVI Status Codes