![]() | SetTrailingForReads |
Specifies the string that should be automatically stripped from the device response.
virtual void SetTrailingForReads(const CString& str) abstract;
[in] String which should be automatically removed from the device response.
Many instruments return trailing characters, such as "\n", in their response strings. This function is used to automatically have these trailing characters removed from device response strings. The trailing characters specified can be a single character or an entire string. If more than one character is specified in the str parameter, then the device response must be terminated with the entire string in order for it to be removed. No error is generated if a device response does not end in the specified trailing string.
The default trailing string is the line feed character "\n".
The following example demonstrates use of the SetTrailingForReads function.
// CoAcme4321.cpp HRESULT Acme4321::OnFinalInitialize() { HRESULT hr = S_OK; // Response strings will be stripped of CR/LF combination, if present hr = io.SetTrailingForReads(_T("\r\n")); return hr; }