COP3014 stdout file pointer
FILE* is available via
#include <stdio.h>.
The arguments following the format string are the
expressions to be printed for each of the format specifiers within the format string.
A FILE* is called a
file pointer
what is a file pointer, FILE*?
is a pointer to a FILE structure that allows programs to read and write to files.
The first argument to fprintf()
is the FILE* to the file being written.
stdout is a
predefined FILE* that is pre-associated with a system's standard output, usually a computer screen.
The FILE structure typically maintains an output buffer that
temporarily stores characters until the system copies those characters to disk or screen.
The second argument for the fprintf() function is
the format string that specifies the format of the text that will be printed along with any number of format specifiers for printing values stored in variables.
The FILE structure maintains
the information needed to access files.
The remaining arguments for fprintf()
work the same way as the arguments for printf().
The fprintf() function, or "file print",
writes a sequence of characters to a file.