f78 freopen[open a file using an existing file descriptor]

Contents|Index|Previous|Next

freopen
[open a file using an existing file descriptor]

SYNOPSIS 
#include <stdio.h> 
FILE *freopen(const char * file, const char * mode, FILE * fp); 

DESCRIPTION
Use
freopen, a variant of fopen, if you wish to specify a particular file descriptor, fp (notably stdin, stdout, or stderr), for the file.

If fp was associated with another file or stream, freopen closes that other file or stream (but ignores any errors while closing it).

file and mode are used just as in fopen.

RETURNS
If successful, the result is the same as the argument,
fp. If the file cannot be opened as specified, the result is NULL.

COMPLIANCE
ANSI C requires
freopen.

Supporting OS subroutines required: close, fstat, isatty, lseek, open, read, sbrk, write.

0