Node:Formatted string output, Next:, Previous:Unformatted string output, Up:String output and input



Formatted string output

The functions in this section are for formatted output of strings to streams. They are generally quite safe to use.

Formatted output is textual output via functions such as printf or fprintf. These take as an argument a string containing special character sequences such as %d (which indicates that an integer argument will follow). After this string, other arguments that correspond to the special character sequences follow. When the functions combine these arguments, the result is formatted textual output.

The next several sections discuss four formatted output functions. The most basic, printf, prints to standard output. The fprintf function is a high-level routine that sends its output to a stream, sprintf "prints" to a string, and asprintf is a safer way of printing to a string.