niDCPower_GetError

NI-DCPower Function Reference

niDCPower_GetError

ViStatus niDCPower_GetError(ViSession vi, ViStatus *Code, ViInt32 bufferSize, ViChar description[])

Purpose

Retrieves and then clears the IVI error information for the session or the current execution thread unless bufferSize is 0, in which case the function does not clear the error information. By passing 0 for the buffer size, you can ascertain the buffer size required to get the entire error description string and then call the function again with a sufficiently large buffer size.

If the user specifies a valid IVI session for vi, this function retrieves and then clears the error information for the session. If the user passes VI_NULL for vi, this function retrieves and then clears the error information for the current execution thread. If vi is an invalid session, the function does nothing and returns an error. Normally, the error information describes the first error that occurred since the user last called niDCPower_GetError or niDCPower_ClearError.

Parameters

Input
Name Type Description
vi ViSession Identifies a particular instrument session. vi is obtained from the niDCPower_init or niDCPower_InitWithOptions function.
bufferSize ViInt32 Specifies the number of bytes in the ViChar array you specify for description.

If the error description, including the terminating NUL byte, contains more bytes than 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 pass a negative number, the function copies the value to the buffer regardless of the number of bytes in the value.

If you pass 0 for this attribute, you can pass VI_NULL for description.

Output
Name Type Description
Code ViStatus* Returns the error code for the session or execution thread.
description ViChar[] Returns the error description for the IVI session or execution thread. If there is no description, the function returns an empty string.

The buffer must contain at least as many elements as the value you specify with bufferSize. If the error description, including the terminating NUL byte, contains more bytes than you indicate with bufferSize, 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 pass 0 for bufferSize, you can pass VI_NULL for this attribute.

Return Value

Name Type Description
StatusViStatus

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.