[in] Array of bytes to write to the device.
LowLevelWrite
Writes raw bytes directly to a device without going through the formatted I/O write buffer.
Syntax
Section titled “Syntax”virtual HRESULT LowLevelWrite(BYTE* pBuf, long cbDesired, long* pcbActual = NULL, bool bAddTrailing = true, long lTimeout = CUR_TIMEOUT) override;
virtual HRESULT LowLevelWrite(SAFEARRAY* pBuf, long cbDesired = -1, long* pcbActual = NULL, bool bAddTrailing = true, long lTimeout = CUR_TIMEOUT) override;Parameters
Section titled “Parameters”pBuf
cbDesired
[in] Number of bytes to write to the device. If pBuf is a SAFEARRAY and cbDesired is -1, then the entire contents of the SAFEARRAY are sent to the device.
pcbActual
[out] Actual number of bytes written to the device. pcbActual may be set to NULL if the caller is not interested in knowing the actual number of bytes written.
bAddTrailing
[in] true to have the trailing characters specified by the SetTrailingForWrites function automatically added to pBuf before sending to the device.
lTimeout
[in] I/O timeout value in milliseconds.
Return value
Section titled “Return value”Returns S_OK if successful, otherwise a failure HRESULT.
Remarks
Section titled “Remarks”Unlike the buffered I/O functions, such as Printf, Write and WriteNumber, etc., the LowLevelWrite function sends raw bytes directly to the device, rather than going through the formatted I/O write buffer.
Example
Section titled “Example”The following example demonstrates use of the LowLevelWrite function.
STDMETHODIMP Acme4321::IAcme4321_Configure(SAFEARRAY* psaData){ HRESULT hr = S_OK;
// Write 1000 bytes from psaData hr = io.LowLevel.LowLevelWrite(psaData, 1000);
return hr;}