home *** CD-ROM | disk | FTP | other *** search
/ BCI NET 2 / BCI NET 2.iso / archives / programming / c / fhopen.lha / fhopen.adoc next >
Encoding:
Text File  |  1994-12-08  |  2.3 KB  |  81 lines

  1. stdio/fhopen                                            stdio/fhopen
  2.  
  3.    NAME
  4.         fhopen - associate a file pointer with an already open AmigaDOS
  5.                  file handle
  6.  
  7.    SYNOPSIS
  8.         #include <dos/dos.h>
  9.         #include <stdio.h>
  10.  
  11.         FILE *fp = fhopen(fh, modes);
  12.         BPTR fh;
  13.         char *modes;
  14.  
  15.    FUNCTION
  16.         fhopen associates an already open AmigaDOS file handle with a
  17.         file pointer.  Note that fclose()ing the file pointer will also
  18.         Close() the file handle - use fhclose() if you want to free the
  19.         file pointer but still use the file handle.
  20.  
  21.         Refer to the fopen manual page for a description of available
  22.         modes.  Note that when you use fhopen the file will not be
  23.         truncated.
  24.  
  25.         The mode string should be similar to the access mode that was
  26.         used to open the file handle:
  27.             MODE_READWRITE      "w+" or "r+"
  28.             MODE_OLDFILE        "r"
  29.             MODE_NEWFILE        "w" or "a"
  30.         Using an append mode will cause a Seek() to the end of file.
  31.  
  32.    NOTE
  33.         refer to the file_pointer manual page for general information
  34.  
  35.    INPUTS
  36.         BPTR fh;        BCPL pointer to a file handle
  37.         char *modes;    modes string, such as "r+".
  38.  
  39.    RESULTS
  40.         FILE *fp;       new file pointer or NULL if an error occured
  41.  
  42.    SEE ALSO
  43.         fhclose, fdopen, fopen, dos.library/Open
  44.  
  45.  
  46. stdio/fhclose                                           stdio/fhclose
  47.  
  48.    NAME
  49.         fhclose - close file pointer from fhopen() without closing
  50.                   AmigaDOS file handle
  51.  
  52.    SYNOPSIS
  53.         #include <dos/dos.h>
  54.         #include <stdio.h>
  55.  
  56.         int error = fhclose(fp);
  57.         FILE *fp;
  58.  
  59.    FUNCTION
  60.         fhclose flushes any data remaining in the file pointer's output
  61.         buffer and then frees the file pointer, but without closing the
  62.         file handle.  The file pointer is no longer valid, but the
  63.         file handle is.
  64.  
  65.         fclose returns any error condition that occured while flushing
  66.         the buffered data to the file.  The file pointer is still free'd
  67.         even if an error occurs.
  68.  
  69.    NOTE
  70.         refer to the file_pointer manual page for general information
  71.  
  72.    INPUTS
  73.         FILE *fp;       file pointer from fhopen()
  74.  
  75.    RESULTS
  76.         int error;      error number, or 0 if none
  77.  
  78.    SEE ALSO
  79.         fhopen, fclose, dos.library/Close
  80.  
  81.