Keysight VISA.NET Help
Formatting Characters

Formatting Characters

A character argument has a format specifier of the following form:

%[flags][width][.precision]c

Modifier

Interpretation

Default Functionality

The argument is interpreted as a single-byte character. The character is sent to the device without change.

flags

-, Q, q

Controls justification and padding of the output, as follows:

  • '-' left aligns the result with the given field width.
  • 'q' places single quotes around the character to be printed.
  • 'Q' places double quotes around the character to be printed.

width

Minimum field width of the output string.

An asterisk (*) may be present in lieu of an integer width modifier, in which case an extra Int32 argument supplies the value.

precision

Maximum number of characters to send.

An asterisk (*) may be present in lieu of an integer precision modifier, in which case an extra Int32 argument supplies the value.

Single-character output

Remember that Printf is adding characters to the formatted write buffer. The comments after each Printf call show what character(s) are added to the formatted write buffer by that call. Assume that the io variable is a valid reference to IMessageBasedFormattedIO.

Example Title
Copy Code
io.Printf(_T("|%c|"), 'A');            // Adds |A|
io.Printf(_T("|%5c|"), 'A');           // Adds |    A|
io.Printf(_T("|%-*c|"), 5, 'A');       // Adds |A    |

 

 

 


© Keysight Technologies 2015-2025