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. The calling thread is blocked until the write is completed. Writing operation will succeed only for those tag elements which have read/write access.
Syntax
ctTagWrite(hCTAPI, sTag, sValue)
hCTAPI
Type: Handle
Input/output: Input
Description: The handle to the CTAPI as returned from ctOpen().
sTag
Type: LPCSTR
Input/output: Input
Description: The tag name or tag name and element name, separated
by a dot. 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.
sValue
Type: LPCSTR
Input/output: Input
Description: The value to write to the tag as a string.
Return Value
TRUE if successful, otherwise FALSE. Use GetLastError() to get extended error information.
Related Functions
Example
HANDLE hCTAPI = ctOpen(NULL, NULL, NULL, 0);
ctTagWrite (hCTAPI,"PV123", "123.12");
ctTagWrite (hCTAPI,"PV123.Field", "123.12");
ctTagWrite (hCTAPI,"PV123.Field.V", "123.12");
ctTagWrite (hCTAPI,"PV123.ControlMode", "1");
ctTagWrite (hCTAPI,"PV123.Status", "0");