Keysight VISA.NET Help
Printf Format Strings

Printf Format Strings

Format strings contain information that describes how to format data into a Formatted I/O write buffer, which is then sent from a PC to a connected device (instrument). The first parameter to every Printf method is a format string. Format strings can include ordinary characters, escape sequences, and format specifiers; these are treated as follows:

You can use any language-specific escape sequence in a format string. Regardless of the language, several escape sequences are always recognized by VISA.NET, as shown in the table below.

The Printf Format Specifier Syntax topics describe Printf format specifier syntax in detail.

Strings in .NET are UNICODE, but all text added to the write buffer must be single character ASCII. Therefore, format strings may not contain any characters greater than 255, and an octal escape sequence (\###) may never specify a character greater than 255.

VISA.NET Escape Sequences

The following table lists VISA.NET defined escape sequences and describes what they send to the device.

Escape Sequence

Effect on Write Buffer

\n

Appends an ASCII new line character (LF) to the write buffer. Since \n is also the default termination character, Printf appends an END, sends the content of the write buffer to the connected device, and flushes all data from the write buffer.

Note that the termination character may be changed to something different, but this feature is only needed when the instrument is not IEEE 488.2 compliant.

\r

Appends an ASCII carriage return character (CR) to the write buffer.

\t

Appends an ASCII TAB character to the write buffer.

\###

Appends the ASCII character specified by the octal value to the write buffer.

\"

Appends an ASCII double-quote (") character to the write buffer.

\\

Appends an ASCII backslash (\) character to the write buffer.

See Also

 

 


© Keysight Technologies 2015-2025