FILE Definition FILE
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 buff-
er. _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
_FASCII 0x20 File is in ASCII mode
_FWRITE 0x40 File is is opened for writing
_FDONTC 0x80 Don't close file
_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 ungetc, should it be
used.
***** See Also *****
definitions, fopen(), freopen(), stdio.h, stream
COHERENT Lexicon Page 1
FILE Definition FILE
COHERENT Lexicon Page 2