The fprintf procedure is similar to the print procedure, except that the created formatted character string is appended to a file, rather than being displayed at the user’s terminal.
See the discussion on printf for a more detailed discussion on how to create use format command characters within the format control string.
fprintf (filename, controlstring [,expression1, …]);
|filename||Required. Character string that contains the name of a file. A fully qualified path name, starting with a forward slash character (/).|
|controlstring||Required. The character string, including format command characters, that is written to filename.|
|expression1...||Optional. Values to substitute into controlstring, based on the specified format command characters.|
Because fprintf is a procedure, no return value is set.
In this example,
fprintf ("/var/adm/pblog.txt", "System administrator Ids: %s %s %s", "Adm1", "Adm2", "Adm3");
the character string System administrator Ids: Adm1 Adm2 Adm3 is appended to the file /var/adm/pblog.txt.
print, printf, sprintf(), syslog