AT&T UNIX™PC Unix System V Users Manual - tenox
AT&T UNIX™PC Unix System V Users Manual - tenox AT&T UNIX™PC Unix System V Users Manual - tenox
FOPEN(3S) FOPEN (3S) NAME fopen, freopen, fdopen - open a stream SYNOPSIS #include FILE •fopen (file-name, type) char •file-name, •type; FILE *freopen (file-name, type, stream) char •file-name, Hype; FILE *stream; FILE •fdopen (fildes, type) int fildes; char *type; DESCRIPTION Fopen opens the file named by file-name and associates a stream with it. Fopen returns a pointer to the FILE structure associated with the stream. File-name points to a character string that contains the name of the file to be opened. Type is a character string having one of the following values: "r" open for reading "w" truncate or create for writing "a" append; open for writing at end of file, or create for writing "r+" open for update (reading and writing) "w+" truncate or create for update "a+" append; open or create for update at end-of-file Freopen substitutes the named file in place of the open stream. The original stream is closed, regardless of whether the open ultimately succeeds. Freopen returns a pointer to the FILE structure associated with stream . Freopen is typically used to attach the preopened streams associated with stdin, stdout and stderr to other files. Fdopen associates a stream with a file descriptor obtained from open, dup, ere at, or pipe(2), which will open files but not return pointers to a FILE structure stream which are necessary input for many of the section 3S library routines. The type of stream must agree with the mode of the open file. When a file is opened for update, both input and output may be done on the resulting stream. However, output may not be directly followed by input without an intervening [seek or rewind, and input may not be directly followed by output without an intervening [seek, rewind, or an input operation which encounters end-of-file. When a file is opened for append (i.e., when type is "a" or "a+"), it is impossible to overwrite information already in the file. Fseek - 1 -
- Page 789: A64L ( 3C ) A64L ( 3C ) NAME a641,
- Page 793: ABS (3C) ABS (3C) NAME abs - return
- Page 797: ATOF ( 3C ) ATOF ( 3C ) NAME atof -
- Page 800 and 801: ·�
- Page 803: CLOCK( 3C ) CLOCK( 3C ) NAME clock
- Page 806 and 807: J ··- � . ..._ __ .·
- Page 809: CTERMID ( 3S ) CTERMID ( 3S ) NAME
- Page 812 and 813: CTIME (3C) CTIME(3C) The external l
- Page 815 and 816: CURSES ( 3 ) CURSES ( 3 ) NAME curs
- Page 817 and 818: CUSERID ( 3S ) CUSERID ( 3S ) NAME
- Page 819 and 820: DIAL (3C) DIAL(3C) NAME dial - esta
- Page 821 and 822: DRAND48 ( 3C ) DRAND48 ( 3C ) NAME
- Page 823 and 824: DRAND48 ( 3C ) DRAND48 ( 3C ) have
- Page 825: ECVT (3C) ECVT (3C) NAME ecvt, fcvt
- Page 829 and 830: EPRINTF ( 3T ) ( AT&T UNIX PC only
- Page 831 and 832: ERF (3M) ERF (3M) NAME erf1 erfc -
- Page 833: EXP ( 3M ) EXP ( 3M ) NAME exp, log
- Page 837: FERROR (3S) FERROR (3S) NAME ferror
- Page 842 and 843: FOPEN (3S) FOPEN (3S) may be used t
- Page 844 and 845: FORM(3T) (AT&T UNIX PC only ) FORM
- Page 846 and 847: FORM{3T) { }; (AT&T UNIX PC only )
- Page 848 and 849: FORM(3T) (AT&T UNIX PC only ) FORM(
- Page 851: FREXP ( 3C ) FREXP ( 3C ) NAME frex
- Page 855: FTW(3C) FTW(3C) NAME ftw - walk a f
- Page 858 and 859: �·. (
- Page 860 and 861: I� i -� ·-
- Page 863: GETENV (3C) NAME getenv - return va
- Page 866 and 867: GETGRENT ( 3C ) GETGRENT ( 3C ) WAR
- Page 869 and 870: GETOPT (3C) GETOPT (3C) NAME getopt
- Page 871: GETP ASS ( 3C ) GETP ASS ( 3C ) NAM
- Page 874 and 875: � ' ) '"- '
- Page 877 and 878: GETPWENT ( 30 ) GETPWENT ( 30 ) NAM
- Page 879: GETS ( 3S ) GETS ( 3S ) NAME gets,
- Page 882 and 883: GETUT (3C) GETUT (3C) line-> ut_lin
- Page 884 and 885: HSEARCH ( 3C ) HSEARCH ( 3C ) START
- Page 886 and 887: I� ', ...____... .. � · � \
- Page 889 and 890: LDAHREAD ( 3X ) LDAI-IREAD ( 3X ) N
FOPEN(3S) FOPEN (3S)<br />
NAME<br />
fopen, freopen, fdopen - open a stream<br />
SYNOPSIS<br />
#include <br />
FILE •fopen (file-name, type)<br />
char •file-name, •type;<br />
FILE *freopen (file-name, type, stream)<br />
char •file-name, Hype;<br />
FILE *stream;<br />
FILE •fdopen (fildes, type)<br />
int fildes;<br />
char *type;<br />
DESCRIPTION<br />
Fopen opens the file named by file-name and associates a stream<br />
with it. Fopen returns a pointer to the FILE structure associated<br />
with the stream.<br />
File-name points to a character string that contains the name of<br />
the file to be opened.<br />
Type is a character string having one of the following values:<br />
"r" open for reading<br />
"w" truncate or create for writing<br />
"a" append; open for writing at end of file, or<br />
create for writing<br />
"r+" open for update (reading and writing)<br />
"w+" truncate or create for update<br />
"a+" append; open or create for update at end-of-file<br />
Freopen substitutes the named file in place of the open stream.<br />
The original stream is closed, regardless of whether the open ultimately<br />
succeeds. Freopen returns a pointer to the FILE structure<br />
associated with stream .<br />
Freopen is typically used to attach the preopened streams associated<br />
with stdin, stdout and stderr to other files.<br />
Fdopen associates a stream with a file descriptor obtained from<br />
open, dup, ere at, or pipe(2), which will open files but not return<br />
pointers to a FILE structure stream which are necessary input for<br />
many of the section 3S library routines. The type of stream must<br />
agree with the mode of the open file.<br />
When a file is opened for update, both input and output may be<br />
done on the resulting stream. However, output may not be<br />
directly followed by input without an intervening [seek or rewind,<br />
and input may not be directly followed by output without an<br />
intervening [seek, rewind, or an input operation which encounters<br />
end-of-file.<br />
When a file is opened for append (i.e., when type is "a" or "a+"),<br />
it is impossible to overwrite information already in the file. Fseek<br />
- 1 -