In the C Programming Language, the freopen characteristic first closes the file related with stream. Then the freopen function opens filename and associates it with stream. In essence, it associates a unique file to a flow that is already open.
The syntax for the fopen function in the C Language is:
FILE *freopen(const char *filename, const char *mode, FILE *stream);
Parameters or Arguments
filename The filename to associate with the file being reopened. mode The mode in which to open the file. stream The stream to accomplice with filename.
The freopen function returns a file pointer for the opened file. If the file can not be opened, the freopen feature returns a null pointer.
In the C Language, the required header for the freopen feature is:
In the C Language, the freopen feature can be used in the following versions:
Other C features that are similar to the freopen function:
fopen function <stdio.h>
Other C functions that are noteworthy when dealing with the freopen function:
fclose characteristic setbuf feature setvbuf feature