ClassPrefix_GetAttributeViString

CVI/LabWindows IVI Class Driver

ClassPrefix_GetAttributeViString

IVI Inherent Function

To form the ClassPrefix_ of the function name, use the prefix of the class driver with which you are working. For example, if you are working with the IviDmm class driver, use the prefix IviDmm_ to create the correct function name, IviDmm_GetAttributeViString.

C Function Prototype

ViStatus ClassPrefix_GetAttributeViString (ViSession vi, ViConstString channel,ViAttr attributeID, ViInt32 arraySize, ViChar attributeValue[]);

Purpose

This function queries the value of a ViString attribute.

You can use this function to get the values of class attributes, instrument specific attributes and inherent IVI attributes. If the attribute represents an instrument state, this function performs instrument I/O in the following cases:

  • State caching is disabled for the entire session or for the particular attribute.
  • State caching is enabled and the currently cached value is invalid.

You must provide a ViChar array to serve as a buffer for the value. You pass the number of bytes in the buffer as the arraySize parameter. If the current value of the attribute, including the terminating NULL byte, is larger than the size you indicate in the arraySize parameter, the function copies arraySize–1 bytes into the buffer, places an ASCII NULL byte at the end of the buffer, and returns the array size you must pass to get the entire value. For example, if the value is "123456" and the arraySize is 4, the function places "123" into the buffer and returns 7.

If you want to call this function just to get the required array size, you can pass 0 for the arraySize and VI_NULL for the attributeValue buffer.

If you want the function to fill in the buffer regardless of the number of bytes in the value, pass a negative number for the arraySize parameter.

Parameters

Name Type Description
vi ViSession The instrument handle that you obtain from the ClassPrefix_init or ClassPrefix_InitWithOptions functions. The handle identifies a particular IVI session.
channel ViConstString If the attribute is channel-based, pass a channel string or virtual channel name. Otherwise, pass VI_NULL or an empty string.

Note  None of the attributes of the IviDmm class are channel-based. Therefore you always pass VI_NULL or an empty string when accessing the IviDmm class driver.
attributeID ViAttr The ID of the attribute.
bufferSize ViInt32 The number of bytes in the ViChar array you specify for the attributeValue parameter.
attributeValue ViChar[] Returns the current value of the attribute.

Return Values