1FOPEN(3S)                                                            FOPEN(3S)
2
3
4

NAME

6       fopen, freopen, fdopen - open a stream
7

SYNOPSIS

9       #include <stdio.h>
10
11       FILE *fopen(filename, type)
12       char *filename, *type;
13
14       FILE *freopen(filename, type, stream)
15       char *filename, *type;
16       FILE *stream;
17
18       FILE *fdopen(fildes, type)
19       char *type;
20

DESCRIPTION

22       Fopen opens the file named by filename and associates a stream with it.
23       Fopen returns a pointer to be used to identify the stream in subsequent
24       operations.
25
26       Type is a character string having one of the following values:
27
28       "r"  open for reading
29
30       "w"  create for writing
31
32       "a"  append: open for writing at end of file, or create for writing
33
34       Freopen  substitutes  the  named  file in place of the open stream.  It
35       returns the original value of stream.  The original stream is closed.
36
37       Freopen is typically used  to  attach  the  preopened  constant  names,
38       stdin, stdout, stderr, to specified files.
39
40       Fdopen  associates  a stream with a file descriptor obtained from open,
41       dup, creat, or pipe(2).  The type of the stream  must  agree  with  the
42       mode of the open file.
43

SEE ALSO

45       open(2), fclose(3)
46

DIAGNOSTICS

48       Fopen  and  freopen  return  the  pointer  NULL  if  filename cannot be
49       accessed.
50

BUGS

52       Fdopen is not portable to systems other than UNIX.
53
54
55
56                                                                     FOPEN(3S)
Impressum