diff options
Diffstat (limited to 'man3/fopen.3')
-rw-r--r-- | man3/fopen.3 | 45 |
1 files changed, 22 insertions, 23 deletions
diff --git a/man3/fopen.3 b/man3/fopen.3 index e96303c..654c697 100644 --- a/man3/fopen.3 +++ b/man3/fopen.3 @@ -14,7 +14,7 @@ .\" Modified, aeb, 960421, 970806 .\" Modified, joey, aeb, 2002-01-03 .\" -.TH fopen 3 2023-07-20 "Linux man-pages 6.05.01" +.TH fopen 3 2023-10-31 "Linux man-pages 6.7" .SH NAME fopen, fdopen, freopen \- stream open functions .SH LIBRARY @@ -23,7 +23,7 @@ Standard C library .SH SYNOPSIS .nf .B #include <stdio.h> -.PP +.P .BI "FILE *fopen(const char *restrict " pathname \ ", const char *restrict " mode ); .BI "FILE *fdopen(int " fd ", const char *" mode ); @@ -31,12 +31,12 @@ Standard C library ", const char *restrict " mode , .BI " FILE *restrict " stream ); .fi -.PP +.P .RS -4 Feature Test Macro Requirements for glibc (see .BR feature_test_macros (7)): .RE -.PP +.P .BR fdopen (): .nf _POSIX_C_SOURCE @@ -47,7 +47,7 @@ The function opens the file whose name is the string pointed to by .I pathname and associates a stream with it. -.PP +.P The argument .I mode points to a string beginning with one of the following sequences @@ -84,7 +84,7 @@ POSIX is silent on what the initial read position is when using this mode. For glibc, the initial file position for reading is at the beginning of the file, but for Android/BSD/MacOS, the initial file position for reading is at the end of the file. -.PP +.P The .I mode string can also include the letter \[aq]b\[aq] either as a last character or as @@ -97,15 +97,15 @@ conforming systems, including Linux. and adding the \[aq]b\[aq] may be a good idea if you do I/O to a binary file and expect that your program may be ported to non-UNIX environments.) -.PP +.P See NOTES below for details of glibc extensions for .IR mode . -.PP +.P Any created file will have the mode .BR S_IRUSR " | " S_IWUSR " | " S_IRGRP " | " S_IWGRP " | " S_IROTH " | " S_IWOTH (0666), as modified by the process's umask value (see .BR umask (2)). -.PP +.P Reads and writes may be intermixed on read/write streams in any order. Note that ANSI C requires that a file positioning function intervene between output and input, unless an input operation encounters end-of-file. @@ -120,18 +120,18 @@ operation between write and read operations on such a stream. This operation may be an apparent no-op (as in \fIfseek(..., 0L, SEEK_CUR)\fP called for its synchronizing side effect). -.PP +.P Opening a file in append mode (\fBa\fP as the first character of .IR mode ) causes all subsequent write operations to this stream to occur at end-of-file, as if preceded by the call: -.PP +.P .in +4n .EX fseek(stream, 0, SEEK_END); .EE .in -.PP +.P The file descriptor associated with the stream is opened as if by a call to .BR open (2) with the following flags: @@ -186,7 +186,7 @@ The argument is used just as in the .BR fopen () function. -.PP +.P If the .I pathname argument is a null pointer, @@ -197,7 +197,7 @@ that is, .BR freopen () reopens the pathname that is associated with the stream. The specification for this behavior was added in the C99 standard, which says: -.PP +.P .RS In this case, the file descriptor associated with the stream need not be closed @@ -207,7 +207,7 @@ succeeds. It is implementation-defined which changes of mode are permitted (if any), and under what circumstances. .RE -.PP +.P The primary use of the .BR freopen () function is to change the file associated with a standard text stream @@ -235,7 +235,7 @@ provided to or .BR freopen () was invalid. -.PP +.P The .BR fopen (), .BR fdopen (), @@ -245,21 +245,21 @@ functions may also fail and set .I errno for any of the errors specified for the routine .BR malloc (3). -.PP +.P The .BR fopen () function may also fail and set .I errno for any of the errors specified for the routine .BR open (2). -.PP +.P The .BR fdopen () function may also fail and set .I errno for any of the errors specified for the routine .BR fcntl (2). -.PP +.P The .BR freopen () function may also fail and set @@ -285,7 +285,6 @@ T{ .BR freopen () T} Thread safety MT-Safe .TE -.sp 1 .SH STANDARDS .TP .BR fopen () @@ -354,7 +353,7 @@ to .BR EEXIST . This flag is ignored for .BR fdopen (). -.PP +.P In addition to the above characters, .BR fopen () and @@ -362,9 +361,9 @@ and support the following syntax in .IR mode : -.PP +.P .BI " ,ccs=" string -.PP +.P The given .I string is taken as the name of a coded character set and |