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.
_fdopen
 Summary Example                         Up Contents Index Back
─────Run-Time Library───────────────────────────────────────────────────────
 
     The _fdopen function associates an input/output stream with the
     file identified by <handle>, thus allowing a file opened for
     low-level I/O to be buffered and formatted.
 
     Once you use _fdopen to assign a buffer to an open handle, the
     file is equivalent to a stream opened with fopen. Use the new
     stream, not the handle, for all subsequent I/O operations. Close
     the stream with fclose, not _close. This flushes the buffer and
     closes both the stream and the handle.
 
     The <mode> character string specifies the type of access requested
     for the file. Because _fdopen assumes that the <mode> argument is
     a string literal, you must use quotation marks. For example:
 
          _fdopen( handle, "rbc" );
 
     The list below gives the <mode> string used in the fopen and
     _fdopen functions. The list also shows the corresponding <oflag>
     arguments used in the _open and _sopen functions. A complete
     description of the <mode> string argument is given in the
     description of the fopen function.
 
     Type String   _open/_sopen Equivalent Value
 
     "r"           _O_RDONLY
 
     "w"           _O_WRONLY (usually _O_WRONLY | _O_CREAT | _O_TRUNC)
 
     "a"           _O_WRONLY | _O_APPEND (usually _O_WRONLY | _O_CREAT |
                   _O_APPEND)
 
     "r+"          _O_RDWR
 
     "w+"          _O_RDWR (usually _O_RDWR | _O_CREAT | _O_TRUNC)
 
     "a+"          _O_RDWR | _O_APPEND (usually _O_RDWR | _O_APPEND |
                   _O_CREAT)
 
     In addition to the values listed above, the "t" or "b" character
     can be included in the <mode> string to specify the translation
     mode for new lines. These characters correspond to the constants
     used in the _open and _sopen functions, as shown below:
 
     Mode     _open/_sopen Equivalent Value
 
     "t"      _O_TEXT
 
     "b"      _O_BINARY
 
     If "t" or "b" is not given in the <mode> string, the translation
     mode is defined by the default-mode variable _fmode.
 
     In addition to the file attribute and the text or binary mode
     listed above, the <mode> string will accept either "c" or "n" to
     specify commit to disk, or no commit to disk, respectively. These
     characters have no correspondence to constants used in the _open
     and _sopen functions.
 
     Mode     _open/_sopen Equivalent Value
 
     "c"      Commit to disk. No _open/_sopen equivalent value.
 
     "n"      Do not commit to disk. No _open/_sopen equivalent
              value. Default.
 
     If "c" or "n" is not given in the <mode> string, the default mode
     is "n".
 
     The "t", "c", and "n" options are not part of the ANSI standard,
     but are instead Microsoft extensions and should not be used where
     ANSI portability is desired.
 
     Return Value
 
     The _fdopen function returns a pointer to the open stream. A null
     pointer value indicates an error.
                                    -♦-