GetVariable

Gets the details of a user-defined variable.

Syntax

KsError GetVariable(
     UserVariable* Variable
);

Parameters

Variable: the variable you want to get. See the UserVariable structure.

Return value

If the function succeeds, it returns errNoError, otherwise an error code. For more information about the error code, see the KsError list.

Remarks

Usable EtherCAT states

ecatOffline, ecatInit, ecatBoot, ecatPreOP, ecatSafeOP, ecatOP

Example

Copy
// Use the variable name to get the information (variables can be added from another process)
UserVariable variableInfo = { 0 };
wcscpy_s(variableInfo.Name, 64, L"User Control Flag");

nRet = GetVariable(&variableInfo);
if (nRet == errNoError)
{
    // Access the user variable in your application
}

Requirements

  RT Win32
Minimum supported version 4.1 4.1
Header ksapi.h ksapi.h
Library KsApi_Rtss.lib KsApi.lib

See also

AddVariable

AddVariableEx

GetVariableEx

GetVariables

GetVariablesEx

RemoveVariable