Click or drag to resize

ReadList

Reads a delimited list of values from a device.


				virtual HRESULT ReadList(double* pValues, long lMaxLength, long* plActualLength, const CString& strListSeparator = _T(","), long lTimeout = CUR_TIMEOUT) abstract;

				virtual HRESULT ReadList(float* pValues, long lMaxLength, long* plActualLength, const CString& strListSeparator = _T(","), long lTimeout = CUR_TIMEOUT) abstract;

				virtual HRESULT ReadList(long* pValues, long lMaxLength, long* plActualLength, const CString& strListSeparator = _T(","), long lTimeout = CUR_TIMEOUT) abstract;

				virtual HRESULT ReadList(short* pValues, long lMaxLength, long* plActualLength, const CString& strListSeparator = _T(","), long lTimeout = CUR_TIMEOUT) abstract;

				virtual HRESULT ReadList(BYTE* pValues, long lMaxLength, long* plActualLength, const CString& strListSeparator = _T(","), long lTimeout = CUR_TIMEOUT) abstract;

				virtual HRESULT ReadList(CComBSTR* pValues, long lMaxLength, long* plActualLength, const CString& strListSeparator = _T(","), long lTimeout = CUR_TIMEOUT) abstract;

				virtual HRESULT ReadList(SAFEARRAY** pValues, IoDataType eType, const CString& strListSeparator = _T(","), long lTimeout = CUR_TIMEOUT) abstract;
			
Parameters
pValues

[out] Array of delimited values parsed from the device.

IoDataType

[in] Type of element data for the SAFEARRAY.

lMaxLength

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

plActualLength

[out] Actual number of elements (not bytes) read from the device.

strListSeparator

[in] Set of characters that act as delimiters between elements in the list.

lTimeout

[in] I/O timeout value in milliseconds.

Return Value

Returns S_OK if successful, otherwise a failure HRESULT.

Remarks

The ReadList function reads delimited strings from a device and converts them into an array of numeric values. List elements in the response can be separated by any of the characters in the strListSeparator parameter. If the each element in device response could not be parsed into the type requested, this function returns an error.

Example

The following example demonstrates use of the ReadList function.

C++
// CoAcme4321.cpp
STDMETHODIMP Acme4321::IAcme4321_ReadData(SAFEARRAY** ppsa)
{
  HRESULT hr = S_OK;

  hr = io.WriteStringNoPoll(_T("DATA?"));

  // Instrument response is:
  //    1.43,2E-6,5.66
  hr = io.ReadList(ppsa, IoDataTypeReal64);

  return hr;
}
See Also

Download a complete CHM version of this documentation here.