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.
Syntax
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.
Returns
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.
Required Header
In the C Language, the required header for the freopen feature is:
#include <stdio.h>
Applies To
In the C Language, the freopen feature can be used in the following versions:
ANSI/ISO 9899-1990
Similar Functions
Other C features that are similar to the freopen function:
fopen function <stdio.h>
See Also
Other C functions that are noteworthy when dealing with the freopen function:
fclose characteristic setbuf feature setvbuf feature
Leave a Review