On this Page
fp.fprintf
Writes formatted text to a file
Syntax
fp.fprintf(
format[,
p1[,
p2 ...]])
Parameters
format is a template string to be written to the file. It is similar to a C-format string with embedded %s, %d, and %f markers that get replaced by parameters passed to fprintf
. For a more complete description of the formatting, process see _printf
.
p1, p2, ... are parameters to be substituted into the format string.
Returned Value
None
Description
A previous call to _file.fopen
must have been made. It returns a new file object fp
. That object must then be used to call fprintf
.
Example
var fp = _file.fopen("myfile.txt", "w"); // open for write var sName = "Wayne Hall"; fp.fprintf("Name='%s'\n", sName); fp.fclose();