F_VN_GetNumberOfElements
Gets the number of elements in the container. (Alternatively use interface method .getElementNum.)
Syntax
Definition:
FUNCTION F_VN_GetNumberOfElements : HRESULT
VAR_INPUT
ipContainer : ITcVnContainer;
END_VAR
VAR_IN_OUT
nNumberOfElements : ULINT;
END_VAR
VAR_INPUT
hrPrev : HRESULT;
END_VAR
Inputs
Name |
Type |
Description |
---|---|---|
ipContainer |
Container | |
hrPrev |
HRESULT indicating the result of previous operations (If SUCCEEDED(hrPrev) equals false, no operation is executed.) |
In/Outputs
Name |
Type |
Description |
---|---|---|
nNumberOfElements |
ULINT |
Returns the number of elements in ipContainer |
Further information
This function should not be used to iterate over the elements of a container. Use iterators to access the elements instead. In particular, the following code construct is not recommended:
hr := F_VN_GetNumberOfElements(ipContainer, ipNumber, hr);
FOR i:=0 TO (ipNumber-1) DO
// access container elements
END_FOR
Since ipNumber
is a UDINT
(natural integer), a return value of ipNumber = 0
would cause an underflow.
Required License
TC3 Vision Base
System Requirements
Development environment | Target platform | PLC libraries to include |
---|---|---|
TwinCAT V3.1.4024.54 or later | PC or CX (x64) with PL50, e.g. Intel 4-core Atom CPU | Tc3_Vision |