Prints values to a file. The general syntax for its use is
fprintf(fp,format,a1,a2,...).
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. For
more details on the format string, see printf
. Note also
that fprintf
to the file handle 1
is effectively equivalent to printf
.
A number of examples are present in the Examples section of the printf
command.