RFmxInstr_GetErrorString
- Updated2025-04-08
- 2 minute(s) read
Converts a status code returned by an RFmxInstr function into a user-readable string. You must provide a char array to serve as a buffer for the value. Pass the number of bytes in the buffer as the errorDescriptionBufferSize parameter.
Syntax
int32 __stdcall RFmxInstr_GetErrorString(niRFmxInstrHandle instrumentHandle, int32 errorCode, int32 errorDescriptionBufferSize, char errorDescription[])
Remarks
If the error description, including the terminating NULL byte, is larger than the size you indicate in the errorDescriptionBufferSize parameter, the function copies buffer size - 1 bytes into the buffer, places an ASCII NULL 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 want to call this function just to get the required buffer size, you must pass 0 for errorDescriptionBufferSize and NULL for the errorDescription buffer.
Parameters
Name | Direction | Type | Description |
---|---|---|---|
instrumentHandle | [in] | niRFmxInstrHandle | Identifies the RFmx session. You can obtain this parameter from the RFmxInstr_Initialize function. |
errorCode | [in] | int32 | Passes the statusOrRequiredSize parameter that is returned from any RFmxInstr function. |
errorDescriptionBufferSize | [in] | int32 | Passes the number of bytes in the char array you specify in errorDescription. If the error description, including the terminating NULL byte, contains more bytes than you indicate in this parameter, the function copies errorDescriptionBufferSize - 1 bytes into the buffer, places an ASCII NULL byte at the end of the buffer, and returns the size of the buffer that 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. |
errorDescription | [out] | char | Returns the user-readable message string that corresponds to the status code you specify. If you pass 0 for errorDescriptionBufferSize, you can pass NULL for the errorDescription buffer parameter to get the size of error description message. |
Returns
Returns the status code of this operation. The status code either indicates success or describes an error or warning condition. Examine the status code from each call to an RFmx function to determine if an error has occurred.
When the statusOrRequiredSize return value returns the buffer size, the status code is not returned.
To obtain a text description of the status code and additional information about the error condition, call the RFmxInstr_GetError function.
The general meaning of the status code is as follows:
Value | Meaning |
---|---|
0 | Success |
Positive Values | Warnings |
Negative Values | Errors |