COHERENT manpages

This page displays the COHERENT manpage for FILE [Descriptor for a file stream].

List of available manpages
Index


FILE -- Definition

Descriptor for a file stream
#include <stdio.h>

FILE  describes a  file stream  which can  be either  a file  on disk  or a
peripheral device  through which  data flow.  It  is defined in  the header
file stdio.h.

A pointer to FILE is  returned by fopen(), freopen(), fdopen(), and related
functions.

The FILE structure is as follows:

    typedef struct  FILE
    {
        unsigned char *cp,
                  *dp,
                  *bp;
        int cc;
        int (*gt)(),
            (*pt)();
        int ff;
        char    fd;
        int uc;
    } FILE;

cp points to the current character  in the file.  dp points to the start of
the  data within  the buffer.   bp points  to the file  buffer.  cc  is the
number  of  unprocessed  characters  in  the  buffer.   gt  and  pt  point,
respectively, to  the functions  getc() and  putc(). ff is  a bit  map that
holds the various file flags, as follows:

    _FINUSE 0x01    Unused
    _FSTBUF 0x02    Used by macro setbuf()
    _FUNGOT 0x04    Used by ungetc()
    _FEOF   0x08    Tested by macro feof()
    _FERR   0x10    Tested by macro ferror()

fd is the file descriptor, which is used by low-level routines like open();
it is  also used by  reopen(). Finally, uc  is the character  that has been
``ungotten'' by the function ungetc(), should it be used.

See Also

fopen(),
freopen(),
Programming COHERENT,
stdio.h,
stream
ANSI Standard, §7.9.1