FREOPEN64(3)

NAME
freopen64, _freopen64_r - open a large file using an existing file descriptor

SYNOPSIS

#include <stdio.h>

FILE *freopen64(const char *file, const char *mode, FILE *fp);

FILE *_freopen64_r(struct _reent *ptr, const char *file, const char *mode, FILE *fp);

DESCRIPTION

Use this variant of fopen64 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, freopen64 closes that other file or stream (but ignores any errors while closing it).

file and mode are used just as in fopen.

If file is NULL, the underlying stream is modified rather than closed. The file cannot be given a more permissive access mode (for example, a mode of "w" will fail on a read-only file descriptor), but can change status such as append or binary mode. If modification is not possible, failure occurs.

RETURNS

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

PORTABILITY

freopen is a glibc extension.

Supporting OS subroutines required: close, fstat, isatty, lseek64, open64, read, sbrk, write.