Bitfile  0.9.2
Bit stream file I/O library
Typedefs | Enumerations | Functions
bitfile.h File Reference

Bit file stream library header. More...

#include <stdio.h>
Include dependency graph for bitfile.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Typedefs

typedef struct bit_file_t bit_file_t
 This is shorthand for struct bit_file_t, the of the structure that is used to access all bitfiles. It is analogous to FILE.
 

Enumerations

enum  BF_MODES { BF_READ = 0, BF_WRITE = 1, BF_APPEND = 2, BF_NO_MODE }
 This is an enumeration of the bit file modes (read, write, and append) More...
 

Functions

bit_file_tBitFileOpen (const char *fileName, const BF_MODES mode)
 This function opens a bit file for reading, writing, or appending. More...
 
bit_file_tMakeBitFile (FILE *stream, const BF_MODES mode)
 This function naively wraps a standard file in a bit_file_t structure. More...
 
int BitFileClose (bit_file_t *stream)
 This function closes a bit file and frees all associated data. More...
 
FILE * BitFileToFILE (bit_file_t *stream)
 This function flushes and frees the bitfile structure, returning a pointer to a stdio file corresponding to the bitfile. More...
 
int BitFileByteAlign (bit_file_t *stream)
 This function aligns the bitfile to the nearest byte. More...
 
int BitFileFlushOutput (bit_file_t *stream, const unsigned char onesFill)
 This function flushes an output bit buffer. More...
 
int BitFileGetChar (bit_file_t *stream)
 This function returns the next byte from the file passed as a parameter. More...
 
int BitFilePutChar (const int c, bit_file_t *stream)
 This function writes the byte passed as a parameter to the file passed a parameter. More...
 
int BitFileGetBit (bit_file_t *stream)
 This function returns the next bit from the file passed as a parameter. More...
 
int BitFilePutBit (const int c, bit_file_t *stream)
 This function writes the bit passed as a parameter to the file passed a parameter. More...
 
int BitFileGetBits (bit_file_t *stream, void *bits, const unsigned int count)
 This function reads the specified number of bits from the file passed as a parameter. More...
 
int BitFilePutBits (bit_file_t *stream, void *bits, const unsigned int count)
 This function writes the specified number of bits from the memory location passed as a parameter to the file passed as a parameter. More...
 
int BitFileGetBitsNum (bit_file_t *stream, void *bits, const unsigned int count, const size_t size)
 This function provides a machine independent layer that allows a single function call to stuff an arbitrary number of bits into an integer type variable. More...
 
int BitFilePutBitsNum (bit_file_t *stream, void *bits, const unsigned int count, const size_t size)
 This function provides a machine independent layer that allows a single function call to write an arbitrary number of bits from an integer type variable into a file. More...
 

Detailed Description

Bit file stream library header.

Author
Michael Dipperstein (mdipp.nosp@m.erst.nosp@m.ein@g.nosp@m.mail.nosp@m..com)
Date
January 9, 2004

This file provides definitions and prototypes for a simple library of I/O functions for files that contain data in sizes that aren't integral bytes. An attempt was made to make the functions in this library analogous to functions provided to manipulate byte streams. The functions contained in this library were created with compression algorithms in mind, but may be suited to other applications.

This file is part of the bit file library.
License
The bitfile library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.
The bitfile library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along with this program. If not, see http://www.gnu.org/licenses/.

Enumeration Type Documentation

◆ BF_MODES

enum BF_MODES

This is an enumeration of the bit file modes (read, write, and append)

Enumerator
BF_READ 

indicate that the file is for reading

BF_WRITE 

indicate that the file is for writing

BF_APPEND 

indicate that writes will be appended to the file

BF_NO_MODE 

end of enum