fscanf

freopen

#include <stdio.h>FILE *freopen(const char *fname, const char *mode, FILE *stream); 

The freopen( ) function associates an existing stream with a different file. The end-of-file and error flags are cleared in the process. The new file’s name is pointed to by fname, the access mode is pointed to by mode, and the stream to be reassigned is pointed to by stream. The mode parameter uses the same format as fopen( ); a complete discussion is found in the fopen( ) description.

In C99, fname, mode, and stream are qualified by restrict.

When called, freopen( ) first tries to close a file that may currently be associated with stream. However, if the attempt to close the file fails,
the freopen( ) function still continues to open the other file.

The freopen( ) function returns a pointer to stream on success and a null pointer otherwise.

The main use of freopen( ) is to redirect the system-defined streams stdin, stdout, and stderr to some other file.

Related functions are fopen( ) and fclose( ).




C(s)C++ Programmer's Reference
C Programming on the IBM PC (C Programmers Reference Guide Series)
ISBN: 0673462897
EAN: 2147483647
Year: 2002
Pages: 539

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net