Streams
Stdin, stdout and sdterr are buffer I/O streams.
Other I/O streams can be defined, e.g. FILE * fp;
Since the type FILE is defined in the standard I/O library, we need to include the line: #include <stdio.h> in the source code.
To open/create a new stream, we use fopen with the following prototype:FILE *fopen(char * filename, char *mode);mode can be “r” for read, “w” for write.Example: FILE *fp = fopen(“my_file.txt”,”w”);
We use the functions fprintf and fscanf that work like printf and scanf but get the stream pointer as argument:fprintf(fp,”this file’s name is %s”,”my_file.txt”);
IMPORTANT: close the stream (file) after use:fclose(FILE *fp); Example: fclose(fp);