NI DAQMX Error Handling - ni/grpc-device GitHub Wiki

Error Handling

DAQmxGetErrorString

int32 DAQmxGetErrorString (int32 errorCode, char errorString[], uInt32 bufferSize);

Purpose

Converts the error number returned by an NI-DAQmx function into a meaningful error message.

If you pass in a valid value for errorString and its bufferSize, this function returns as much of the available data as possible.

If you pass NULL for errorString or 0 for bufferSize, this function returns the number of bytes you need to allocate.

Parameters

Input
Name Type Description
errorCode int32 An error code or warning returned by one of the NI-DAQmx Library functions.
bufferSize uInt32 The size, in bytes, of the buffer passed in the errorString. If you pass 0, this function returns the number of bytes you need to allocate.
Output
errorString char [] The meaningful error message for the error number. If you pass NULL, this function returns the number of bytes you need to allocate.

Return Value

Name Type Description
status int32 The error code returned by the function in the event of an error or warning. A value of 0 indicates success. A negative value indicates an error.
If you pass in a valid value for errorString and its bufferSize, this function returns as much of the available data as possible.
If you pass NULL for errorString or 0 for bufferSize, this function returns the number of bytes you need to allocate.

DAQmxGetExtendedErrorInfo

int32 DAQmxGetExtendedErrorInfo (char errorString[], uInt32 bufferSize);

Purpose

Returns dynamic, specific error information. This function is valid only for the last function that failed; additional NI-DAQmx calls may invalidate this information.

If you pass valid values for errorString and bufferSize, this function returns as much of the available data as possible.

If you pass NULL for errorString or 0 for bufferSize, this function returns the number of bytes you need to allocate.

Parameters

Input
Name Type Description
bufferSize uInt32 The size, in bytes, of errorString. If you pass 0, this function returns the number of bytes you need to allocate.
Output
Name Type Description
errorString char [] Dynamic error information. If you pass NULL, this function returns the number of bytes you need to allocate.

Return Value

Name Type Description
status int32 The error code returned by the function in the event of an error or warning. A value of 0 indicates success. A negative value indicates an error.
If you pass in a valid value for errorString and its bufferSize, this function returns as much of the available data as possible.
If you pass NULL for errorString or 0 for bufferSize, this function returns the number of bytes you need to allocate.
⚠️ **GitHub.com Fallback** ⚠️