Reads data from device or interface through the use of a formatted I/O read buffer.
ViStatus viBufRead(ViSession vi, ViPBuf buf, ViUInt32 count, ViPUInt32 retCount)
viBufRead&(ByVal vi&, ByVal buf$, ByVal count&, retCount&)
GPIB INSTR, GPIB INTFC, Serial INSTR, TCPIP INSTR, TCPIP SOCKET, USB INSTR, USB RAW, VXI INSTR, VXI SERVANT
Name | Direction | Description |
---|---|---|
vi |
IN |
Unique logical identifier to a session. |
buf |
OUT |
Location of a buffer to receive data from device. |
count |
IN |
Number of bytes to be read. |
retCount |
OUT |
Number of bytes actually transferred. |
Completion Codes | Description |
---|---|
VI_SUCCESS |
The operation completed successfully and the END indicator was received (for interfaces that have END indicators). This completion code is returned regardless of whether the termination character is received or the number of bytes read is equal to count. |
VI_SUCCESS_TERM_CHAR |
The specified termination character was read but no END indicator was received. This completion code is returned regardless of whether the number of bytes read is equal to count. |
VI_SUCCESS_MAX_CNT |
The number of bytes read is equal to count. No END indicator was received and no termination character was read. |
Error Codes | Description |
---|---|
VI_ERROR_INV_OBJECT |
The given session reference is invalid. |
VI_ERROR_NSUP_OPER |
The given vi does not support this operation. |
VI_ERROR_RSRC_LOCKED |
Specified operation could not be performed because the resource identified by vi has been locked for this kind of access. |
VI_ERROR_TMO |
Timeout expired before operation completed. |
VI_ERROR_IO |
An unknown I/O error occurred during transfer. |
The viBufRead() operation is similar to viRead() and does not perform any kind of data formatting. It differs from viRead() in that the data is read from the formatted I/O read buffer—the same buffer used by viScanf() and related operations—rather than directly from the device. You can intermix this operation with viScanf(), but you should not mix it with viRead().
VI_NULL is a special value for the retCount parameter. If you pass VI_NULL for retCount, the number of bytes transferred is not returned. You may find this useful if you need to know only whether the operation succeeded or failed.
Related Topics