Admin Production ni-theme
Current Publication

CNVRead

LabWindows/CVI

CNVRead

int CNVRead (CNVReader reader, int waitTime, CNVData *data);

Purpose

Reads the value of a network variable using a reader connection.

The first time you call this function, it reads the value the network variable had when the reader connected to it. On subsequent calls, this function reads new values of the network variable. This function waits if there is no change in the network variable since the last read operation. If the specified wait time elapses before CNVRead reads a new value, the function sets the output data parameter to zero and returns success.

Note Note  The throughput rate of data with reader and asynchronous reader connections is slower than with subscriber and buffered subscriber connections. If throughput rate is critical to your application, consider using a subscriber or buffered subscriber connection instead.
Note Note  To avoid deadlocks, do not call this function in a network variable callback function.
Note Note  In this operation, the library flushes all network variable connections in your program for better performance. This also affects writer connections by flushing any pending data.

Parameters

Input
Name Type Description
reader CNVReader The handle that identifies the network variable reader connection.
waitTime int Number of milliseconds that the Network Variable Library waits to read a new value. Pass CNVWaitForever to wait indefinitely. If the specified wait time elapses before CNVRead reads a new value, the function sets the output data parameter to zero and returns success.
Output
Name Type Description
data CNVData Handle of the network variable data. The output value is zero if the specified wait time elapses before CNVRead reads a new value. Call CNVDisposeData to dispose the handle when you are done using it.

Return Value

Name Type Description
status int Return value indicating whether the function was successful. One indicates that a next item was found, zero indicates that a next item was not found, and a negative number indicates that an error occurred.

You can call CNVGetErrorDescription to obtain a string that describes the error.

Additional Information

Library: Network Variable Library

Include file: cvinetv.h

LabWindows/CVI compatibility: LabWindows/CVI 8.1 and later