ISO/ IEC JTC1/SC22/WG14 N729

ISO/IEC JTC1/SC22/WG14 N729

                        Mode strings in fopen()
                          Clive D.W. Feather


Abstract
========

The original wording of 7.12.5.3 a unclear in the interpretation
of mode strings that are not exactly one of those listed. The issue
was touched on in DR143, but both this and the relevant change
proposed in N675 assumed that such strings could not affect a
strictly-conforming program.

However, discussion at the meeting has shown that many people believe
that strings other than those listed can cause the file to have a
behaviour that no longer conforms to the Standard.

This proposal allows such an implementation.


Proposal
========

In subclause 7.12.5.3 (fopen ()), change paragraph 3 from:

    The argument /mode/ points to a string beginning with one of the
    following sequences: [169]

        /r/     open text file for reading
        [remaining list omitted]

to:

    The argument /mode/ points to a string. If the string is one of
 |  the following, the file is opened in the indicated mode. Otherwise
 |  the behaviour is undefined. [169]

        /r/     open text file for reading
        [existing list is left unchanged]

and change footnote 169 from:

    [169] Additional characters may follow these sequences.

to:

    [169] If the string begins with one of the above sequences, the
    implementation might choose to ignore the remaining characters,
    or it might use them to select different kinds of file (some of
    which might not conform to the properties in 7.12.2).