freopen

Substitutes the file named by a file specification for the open file addressed by a file pointer. The latter file is closed.

Format

#include  <stdio.h>

FILE *freopen  (const char *file_spec, const char
               *a_mode, FILE *file_ptr, . . . );

Arguments

file_spec
A pointer to a string that contains a valid OpenVMS or UNIX style file specification. After the function call, the given file pointer is associated with this file.
a_mode
The access mode indicator. The fdopen function in this section describes the access mode argument.
file_ptr
A file pointer.
. . .
Optional file attribute arguments. The file attribute arguments are the same as those used in the creat function.

Description

This function is typically used to associate one of the predefined names stdin, stdout, or stderr with a file. For more information about these predefined names, see Chapter 2.

Return Values
file_ptr  The file pointer, if freopen is successful. 
NULL  Indicates an error. 


Previous Page | Next Page | Table of Contents | Index