C Language and Libraries Help (clang.hlp) (
Table of Contents;
Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software,
purely for historical purposes.
If you're looking for up-to-date documentation, particularly for programming,
you should not rely on the information found here, as it will be woefully
out of date.
"c", "n"
◄Up► ◄Contents► ◄Index► ◄Back►
─────Run-Time Library───────────────────────────────────────────────────────
Constant: "c", "n"
Include: <stdio.h>
Context: _fdopen, fopen
Summary: Specifies whether the buffer associated with the open
file is flushed to the operating system's buffers or to
disk. The mode is included in the string specifying the
type of access ("r", "w", "a", "r+", "w+", "a+").
The modes are described below.
Mode Meaning
"c" Write the unwritten contents of the specified buffer to
disk. This commit-to-disk functionality only occurs at
explicit calls to either the fflush or the _flushall
function. This mode is useful when dealing with sensitive
data. For example, if your program dies after a call to
fflush or _flushall, you can be sure that your data
reached the operating system's buffers. However, unless a
file is opened with the "c" option, the data might never
make it to disk if the operating system also dies.
"n" Write the unwritten contents of the specified buffer to
the operating system's buffers. The operating system can
cache data and then determine an optimal time to write
to disk. Under many conditions, this behavior makes for
efficient program behavior. However, if the retention of
data is critical (such as bank transactions or airline
ticket information) consider using the "c" option. The
"n" mode is the default.
NOTE: The "c" and "n" options are not part of the ANSI standard
for fopen, but are Microsoft extensions and should not be
used where ANSI portability is desired.
See: ◄COMMODE.OBJ►
-♦-