Click or drag to resize

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;
			
Parameters
strCommand

[in] Command to send to the device before sending the binary block.

pValues

[in] Array of numeric values parsed out of the binary block.

IoDataType

[in] Type of element data for the SAFEARRAY.

lMaxLength

[in] Maximum number or elements (not bytes) to read from the device.

bSeekToBlock

[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.

bFlush

[in] If true, the formatted I/O read buffer is flushed.

lTimeout

[in] I/O timeout value in milliseconds.

Return Value

Returns S_OK if successful, otherwise a failure HRESULT.

Remarks

The ReadBinaryBlock function reads data from a device and parses it as an IEEE 488.2 definite-length binary block.

Example

The following example demonstrates use of the ReadBinaryBlock function.

C++
// 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;
}
See Also

Download a complete CHM version of this documentation here.