qc.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
────────────────────────────────────────────────────────────────────────────
 
     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. 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 newlines. 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
 
     The "t" option is not part of the ANSI standard for fopen. It is a
     Microsoft extension and should not be used where ANSI portability
     is desired.
 
     If "t" or "b" is not given in the <mode> string, the translation
     mode is defined by the default-mode variable _fmode.
 
     Return Value
 
     The fdopen function returns a pointer to the open stream. A NULL
     pointer value indicates an error.
                                    -♦-