I/O Format Specifiers for Write Operations
This topic discusses the format specifier fields that may appear in the write format control strings passed to the Printf-style I/O functions. The format specifiers described here apply to the following functions:
- Printf
- PrintfNoPoll
- VPrintf
- Queryf
- QueryfNoPoll
- QueryfWithTimeout
- QueryfWithTimeoutNoPoll
- VQueryf
- VQueryfNoPoll
Write Format Specifier Overview
Section titled “Write Format Specifier Overview”The write format specifier for all Printf-style functions has the following general form:
%[modifiers]type
The type code is the only required field and appears after the optional modifiers. The type code determines whether the associated argument is interpreted as a character, string, number, or array. The type code also determines which modifiers are valid and how they are interpreted. The specific format of the format specifier is given in the various topics in this section for each supported type code.
The table below lists the type codes available along with links to the topics that discuss the format specifier for each data type.
| Type of Data | Format Codes | Help Topic |
|---|---|---|
| Single characters | %c | Writing Characters |
| Strings | %s | Writing Strings |
| Integers | %d, %i, %o, %u, %x, %X | Writing Integers |
| Floating-point numbers | %f, %e, %E, %g, %G | Writing Floating-Point Numbers |
| IEEE 488.2 binary blocks | %b, %B | Writing IEEE 488.2 Binary Blocks |
| Raw binary data | %y | Writing Raw Binary Data |
Special Formatting Characters
Section titled “Special Formatting Characters”Special formatting character sequences send special characters. The following table lists the special characters and describes what they send to the device.
| Formatting Character | Character Sent to Device |
|---|---|
\n | Sends the ASCII linefeed character (LF). The END identifier will also be automatically sent. |
\r | Sends the ASCII carriage return (CR) character. |
\t | Sends the ASCII TAB character. |
\### | Sends the ASCII character specified by the octal value. |
\" | Sends the ASCII double-quote (") character. |
\\ | Sends the ASCII backslash (\) character. |