Technical Reference > CtAPI Functions > Function Reference > ctTagWriteEx


Performs the same as ctTagWrite, but with an additional new argument. Writes to the given CitectSCADA I/O Device variable tag. The value, quality and timestamp, not only a value, is converted into the correct data type, then scaled and then written to the tag. If writing to an array element only a single element of the array is written to. This function will generate a write request to the I/O Server. The time taken to complete this function will be dependent on the performance of the I/O Device.

If the value of pctOverlapped is NULL, the function behaves the same as ctTagWrite, and the calling thread is blocked until the write is completed. If the value of pctOverlapped is not NULL, the write is completed asynchronously and the calling thread is not blocked.


ctTagWriteEx(hCTAPI, sTag, sValue, pctOverlapped)


Type: Handle
Input/output: Input
Description: The handle to the CTAPI as returned from ctOpen().


Input/output: Input
Description: The tag name or tag name and element name, separated by a dot to write to. If the element name is not specified, it will be resolved at runtime as for an unqualified tag reference. You may use the array syntax [] to select an element of an array.


Input/output: Input
Description: The value to write to the tag as a string.


Input/output: Input
Description: Passes in an overlapped structure so ctTagWriteEx can complete asynchronously. If the pctOverlapped structure is NULL, the function will block, completing synchronously.

Return Value

TRUE if successful, otherwise FALSE. Use GetLastError() to get extended error information.

Related Functions

ctOpen, ctTagRead