Click or drag to resize

I/O Format Specifiers for Read Operations

This topic discusses the format specifier fields that may appear in the read format control strings passed to the Printf-style I/O functions. The format specifiers described here apply to the following functions:

Read Format Specifier Overview

The read 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

Reading Characters

Strings

%s, %t, %T, %[]

Reading Strings

Integers

%d, %i, %o, %u, %x, %X

Reading Integers

Floating-point numbers

%f, %e, %E, %g, %G

Reading Floating-Point Numbers

IEEE 488.2 definite-length blocks

%b

Reading IEEE 488.2 Binary Blocks

Raw binary data

%y

Reading Raw Binary Data

Special Formatting Characters

Special formatting character sequences scan special characters. The following table lists the special characters and describes what they expect to receive from the device.

Formatting Character

Character Expected from Device

\n

Reads the ASCII linefeed character (LF).

\r

Reads the ASCII carriage return (CR) character.

\t

Reads the ASCII TAB character.

\###

Reads the ASCII character specified by the octal value.

\"

Reads the ASCII double-quote (") character.

\\

Reads the ASCII backslash (\) character.

See Also

Other Resources

Download a complete CHM version of this documentation here.