.\" Modified, aeb, 960421, 970806
.\" Modified, joey, aeb, 2002-01-03
.\"
-.TH FOPEN 3 2009-02-23 "GNU" "Linux Programmer's Manual"
+.TH FOPEN 3 2012-04-22 "GNU" "Linux Programmer's Manual"
.SH NAME
fopen, fdopen, freopen \- stream open functions
.SH SYNOPSIS
The argument
.I mode
points to a string beginning with one of the following sequences
-(Additional characters may follow these sequences.):
+(possibly followed by additional characters, as described below):
.TP
.B r
Open text file for reading.
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 an
+at end-of-file, as if preceded the call:
.nf
fseek(stream,0,SEEK_END);
.fi
.PP
-call.
-.PP
The
.BR fdopen ()
function associates a stream with the existing file descriptor,
Do not make the open operation,
or subsequent read and write operations,
thread cancellation points.
+This flag is ignored for
+.BR fdopen ().
.TP
.BR e " (since glibc 2.7)"
Open the file with the
See
.BR open (2)
for more information.
+This flag is ignored for
+.BR fdopen ().
.TP
.BR m " (since glibc 2.3)"
Attempt to access the file using
.BR EEXIST .
This flag is ignored for
.BR fdopen ().
-.\" FIXME document /,ccs= charset/
+.PP
+In addition to the above characters,
+.BR fopen ()
+and
+.BR freopen ()
+support the following syntax
+in
+.IR mode :
+
+.BI " ,ccs=" string
+
+The given
+.I string
+is taken as the name of a coded character set and
+the stream is marked as wide-oriented.
+Thereafter, internal conversion functions convert I/O
+to and from the character set
+.IR string .
+If the
+.BI ,ccs= string
+syntax is not specified,
+then the wide-orientation of the stream is
+determined by the first file operation.
+If that operation is a wide-character operation,
+the stream is marked wide-oriented,
+and functions to convert to the coded character set are loaded.
+.SH BUGS
+In versions of glibc before
+.SH BUGS
+When parsing for individual flag characters in
+.IR mode
+(i.e., the characters preceding the "ccs" specification"),
+the glibc implementation of
+.\" FIXME http://sourceware.org/bugzilla/show_bug.cgi?id=12685
+.BR fopen ()
+and
+.BR freopen ()
+limits the number of characters examined in
+.I mode
+to 7 (or, in glibc versions before 2.14, to 6,
+which was not enough to include possible specifications such as "rb+cmxe").
+The current implementation of
+.BR fdopen ()
+parses at most 5 characters in in
+.IR mode .
.SH "SEE ALSO"
.BR open (2),
.BR fclose (3),