CanTranslate
- Updated2025-07-21
- 2 minute(s) read
CanTranslate
long CanTranslate(const char *extension, IDispatch *inputStream, long *index, TSERROR *errorCode, char *errorMsg, long maxErrorMsgLengthInBytes)
Purpose
Determines whether a translator in the DLL can translate the file the extension and inputStream parameters specify and returns the index of the translator that can translate the file.
Parameters
| Name | Type | Description |
|---|---|---|
| extension | string | The extension of the file TestStand attempts to open. The extension parameter does not include the period ( "." ) character in the extension string. |
| inputStream | InputStream | A reference to an InputStream object that contains the contents of the file TestStand attempts to open. |
| index | long | Returns the zero-based index of the translator that can translate the file. |
| errorCode | TSERROR | Returns the error code when an error occurs in the callback. |
| errorMsg | string | Returns the error message when an error occurs in the callback. The callback must copy a string value to the existing buffer, including the NUL terminating character. Use the maxErrorMsgLengthInBytes parameter to determine the size of the buffer. |
| maxErrorMsgLengthInBytes | long | The maximum number of bytes the DLL can copy to the errorMsg parameter. |
Return Value
Returns whether a translator in the DLL can translate the file. A value of 0 indicates that the translator cannot translate the file. A value of 1 indicates that the translator can translate the file.
When CanTranslate returns a non-zero value for the error parameter, TestStand reports an error and does not attempt to call CanTranslate for other sequence file translator DLLs on the computer. National Instruments recommends that translators catch errors that occur while attempting to determine whether the translator can load the file and return 0 from CanTranslate.