Queries the value of a ViString attribute.

Syntax

ViStatus _VI_FUNC niDCPower_GetAttributeViString(ViSession vi, ViConstString channelName, ViAttr attributeId, ViInt32 bufferSize, ViChar attributeValue[])

Remarks

You can use this function to get the values of device-specific attributes and inherent IVI attributes.

Parameters

NameDirectionTypeDescription
vi[in]ViSession

Identifies a particular instrument session. vi is obtained from the niDCPower_InitializeWithIndependentChannels function.

channelName[in]ViConstString

Specifies the channel(s) to use. Specify the channel(s) using the form PXI1Slot3/0,PXI1Slot3/2-3,PXI1Slot4/2-3 or PXI1Slot3/0,PXI1Slot3/2:3,PXI1Slot4/2:3, where PXI1Slot3 and PXI1Slot4 are instrument resource names and 0, 2, and 3 are channels.

If you pass "" for this control, all channels in the session are used.

attributeId[in]ViAttr

Specifies the ID of an attribute.

bufferSize[in]ViInt32

Passes the number of bytes in the buffer and specifies the number of bytes in the ViChar array you specify for attributeValue. If the current value of attributeValue, including the terminating NUL byte, is larger than the size you indicate in this parameter, the function copies (buffer size - 1) bytes into the buffer, places an ASCII NUL byte at the end of the buffer, and returns the buffer size you must pass to get the entire value. For example, if the value is 123456 and the buffer size is 4, the function places 123 into the buffer and returns 7.

To obtain the required buffer size, you can pass 0 for this attribute and VI_NULL for attributeValue. If you want the function to fill in the buffer regardless of the number of bytes in the value, pass a negative number for this attribute.

attributeValue[out]ViChar[]

The buffer in which the function returns the current value of the attribute. The buffer must be of type ViChar and have at least as many bytes as indicated in bufferSize.

If the current value of the attribute, including the terminating NUL byte, contains more bytes that you indicate in this attribute, the function copies (buffer size -1) bytes into the buffer, places an ASCII NUL byte at the end of the buffer, and returns the buffer size you must pass to get the entire value. For example, if the value is 123456 and the buffer size is 4, the function places 123 into the buffer and returns 7.

If you specify 0 for bufferSize, you can pass VI_NULL for this attribute.

Returns

Reports the status of this operation. To obtain a text description of the status code, call niDCPower_error_message. To obtain additional information concerning the error condition, call niDCPower_GetError. The general meaning of the status code is as follows:

Value

Meaning

0

Success

Positive Values

Warnings

Negative Values

Errors