DOCUMENTATION

This program includes code to redefine the functions fopen and _fillbuf from <stdio.h>.  The new versions of these functions use field names to test individual bits of integer flag which is a member of structure type FILE the layout of the file control block.

Structure tag flagbits defines a bit field layout that names the bits of integer flag according to meaning.  Pointer flagbits is a pointer to this type of bit field.  Pointer fp is a pointer to FILE.  When the address of fp->flag is assigned to flagbits, the individual bits can be tested by name.

Note that fp->cnt is the number of bytes from address fp->ptr to the end of the buffer.  For a file opened for reading, it is the number of unread characters remaining in the buffer.  But, for a file opened for writing, it is the amount of space available for new characters.