4.32 Formatted Write
AllApplicationManualNameSummaryHelp

  • Documentation
    • Reference manual
      • Built-in Predicates
        • Formatted Write
          • Writef
            • writef/1
            • writef/2
            • swritef/3
            • swritef/2
          • Format
          • Programming Format
    • Packages

4.32.1 Writef

[deprecated]writef(+Atom)
Equivalent to writef(Atom, []). See writef/2 for details.
[deprecated]writef(+Format, +Arguments)
Formatted write. Format is an atom whose characters will be printed. Format may contain certain special character sequences which specify certain formatting and substitution actions. Arguments provides all the terms required to be output.

Escape sequences to generate a single special character:

\n Output a newline character (see also nl/[0,1])
\l Output a line separator (same as \n)
\r Output a carriage return character (ASCII 13)
\t Output the ASCII character TAB (9)
\\ The character \ is output
\% The character % is output
\nnn where <nnn> is an integer (1-3 digits); the character with code <nnn> is output (NB : <nnn> is read as decimal)

Note that \l, \nnn and \\ are interpreted differently when character escapes are in effect. See section 2.16.1.3.

Escape sequences to include arguments from Arguments. Each time a % escape sequence is found in Format the next argument from Arguments is formatted according to the specification.

%t print/1 the next item (mnemonic: term)
%w write/1 the next item
%q writeq/1 the next item
%d Write the term, ignoring operators. See also write_term/2. Mnemonic: old Edinburgh display/1
%p print/1 the next item (identical to %t)
%n Put the next item as a character (i.e., it is a character code)
%r Write the next item N times where N is the second item (an integer)
%s Write the next item as a String (so it must be a list of characters)
%f Perform a ttyflush/0 (no items used)
%Nc Write the next item Centered in N columns
%Nl Write the next item Left justified in N columns
%Nr Write the next item Right justified in N columns. N is a decimal number with at least one digit. The item must be an atom, integer, float or string.
[deprecated]swritef(-String, +Format, +Arguments)
Equivalent to writef/2, but “writes'' the result on String instead of the current output stream. Example:
?- swritef(S, '%15L%w', ['Hello', 'World']).

S = "Hello          World"
[deprecated]swritef(-String, +Format)
Equivalent to swritef(String, Format, []).