/* * @(#) fbitio.h - File bit I/O support functions library header. * (c) 1998 Ivan Maidanski http://ivmai.chat.ru * Freeware function library source. All rights reserved. ** * Language: ANSI C * Tested with: Watcom C 16/32 v11.0 * Last modified: 1998-06-12 19:20:00 GMT+04:00 */ /* Library source file: fbitio.c */ /* fbitput(), fbitflush(), fbitget(), fbiteof(), fbitvalput(), fbitvalget() */ #ifndef _FBITIO_H_INCLUDED #define _FBITIO_H_INCLUDED #include /* FILE */ /* declaration section */ int fbitput(FILE *, unsigned char *, int); /* fbitput - puts one bit (the 3rd argument) into file; the 2nd argument is a pointer to work buffer (1 byte), which initially must be 0; on error, function returns EOF */ int fbitflush(FILE *, unsigned char *); /* fbitflush - flushes all the bits from work buffer (the 2nd argument) to file (without flushing output file) and resets work buffer; on error, function returns EOF */ int fbitget(FILE *, unsigned char *); /* fbitget - gets one bit from file; the 2nd argument is a pointer to work buffer (1 byte), which initially must be 0; on error or end-of-file, function returns EOF */ int fbiteof(FILE *, unsigned char *); /* fbiteof() - checks for bit-end-of-file using feof() and work buffer; function returns 1 if bit end-of-file reached, otherwize 0 */ int fbitvalput(FILE *, unsigned char *, unsigned long, unsigned long); /* fbitvalput() - puts specified value (the 3rd argument) into file as a serial of bits; work buffer (the 2nd argument) is the same as for fbitput(); current maximal output value (the 4th argument) is necessary to determine the bit length of the stored value (the 3rd argument); on error, function returns EOF */ int fbitvalget(FILE *, unsigned char *, unsigned long *, unsigned long); /* fbitvalget() - gets value stored in the file as a serial of bits; work buffer (the 2nd argument) is the same as for fbitget(); current maximal input value (the 4th argument) is necessary to determine the bit length of the stored value (the 3rd argument); on file error or end-of-file, function returns EOF; if stored value is more than maximal input value the stored value will be wrapped around zero (on value wrap, function returns 1) */ #endif