I/O Buffer Operations

NI-VISA

I/O Buffer Operations

Another method for communicating with your instruments using formatted I/O functions is using the formatted I/O buffer functions: viSPrintf(), viSScanf(), viBufRead(), and viBufWrite(). You can use these functions to manipulate a buffer that you will send or receive from an instrument.

For example, you may want to bring information from a device into a buffer and then manipulate it yourself. To do this, first call viBufRead(), which reads the string from the instrument into a user-specified buffer. Then use viSScanf() to extract information from the buffer. Similarly, you can format a buffer with viSPrintf() and then use viBufWrite() to send it to an instrument.

As you can see, the formatted I/O approach is the simplest way to get the job done. Because of the variety of modifiers you can use in the format string, this topic does not go into any more detail on these operations. Refer to Operations for more information.