Skip to content

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:

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 DataFormat CodesHelp Topic
Single characters%cWriting Characters
Strings%sWriting Strings
Integers%d, %i, %o, %u, %x, %XWriting Integers
Floating-point numbers%f, %e, %E, %g, %GWriting Floating-Point Numbers
IEEE 488.2 binary blocks%b, %BWriting IEEE 488.2 Binary Blocks
Raw binary data%yWriting Raw Binary Data

Special formatting character sequences send special characters. The following table lists the special characters and describes what they send to the device.

Formatting CharacterCharacter Sent to Device
\nSends the ASCII linefeed character (LF). The END identifier will also be automatically sent.
\rSends the ASCII carriage return (CR) character.
\tSends the ASCII TAB character.
\###Sends the ASCII character specified by the octal value.
\"Sends the ASCII double-quote (") character.
\\Sends the ASCII backslash (\) character.