![]() | ReadBinaryBlock |
Reads an IEEE 488.2 definite-length binary block from a device.
virtual HRESULT ReadBinaryBlock(double* pValues, long lMaxLength, long* plActualLength, bool bSeekToBlock = false, bool bFlush = true, long lTimeout = CUR_TIMEOUT) override; virtual HRESULT ReadBinaryBlock(float* pValues, long lMaxLength, long* plActualLength, bool bSeekToBlock = false, bool bFlush = true, long lTimeout = CUR_TIMEOUT) override; virtual HRESULT ReadBinaryBlock(long* pValues, long lMaxLength, long* plActualLength, bool bSeekToBlock = false, bool bFlush = true, long lTimeout = CUR_TIMEOUT) override; virtual HRESULT ReadBinaryBlock(short* pValues, long lMaxLength, long* plActualLength, bool bSeekToBlock = false, bool bFlush = true, long lTimeout = CUR_TIMEOUT) override; virtual HRESULT ReadBinaryBlock(BYTE* pValues, long lMaxLength, long* plActualLength, bool bSeekToBlock = false, bool bFlush = true, long lTimeout = CUR_TIMEOUT) override; virtual HRESULT ReadBinaryBlock(SAFEARRAY** pValues, IoDataType eType, bool bSeekToBlock = false, bool bFlush = true, long lTimeout = CUR_TIMEOUT) override;
[in] Command to send to the device before sending the binary block.
[in] Array of numeric values parsed out of the binary block.
[in] Type of element data for the SAFEARRAY.
[in] Maximum number or elements (not bytes) to read from the device.
[in] If true, characters are read from the device until a valid IEEE 488.2 binary block header is found. If false, the first characters read must be a valid binary block header, else an error is returned.
[in] If true, the formatted I/O read buffer is flushed.
[in] I/O timeout value in milliseconds.
Returns S_OK if successful, otherwise a failure HRESULT.
The ReadBinaryBlock function reads data from a device and parses it as an IEEE 488.2 definite-length binary block.
The following example demonstrates use of the ReadBinaryBlock function.
// CoAcme4321.cpp STDMETHODIMP Acme4321::IAcme4321_QueryData(SAFEARRAY** ppsaData) { HRESULT hr = S_OK; hr = io.WriteStringNoPoll(_T("FORM BIN; DATA?")); // Read IEEE 488.2 definite-length binary block hr = io.ReadBinaryBlock(ppsaData, IoDataTypeReal64); return hr; }