FPRINTF Formated File Output Function (C-Style)

Section: Input/Ouput Functions


Prints values to a file. The general syntax for its use is



Here format is the format string, which is a string that controls the format of the output. The values of the variables ai are substituted into the output as required. It is an error if there are not enough variables to satisfy the format string. Note that this fprintf command is not vectorized! Each variable must be a scalar. The value fp is the file handle. If fp is omitted, file handle 1 is assumed, and the behavior of fprintf is effectively equivalent to printf. For more details on the format string, see printf.


A number of examples are present in the Examples section of the printf command.