| iMatix home page
| << | < | > | >>
SFL Logo SFL
Version 2.11

 

bits_fput

#include "sflbits.h"
int
bits_fput (FILE *file,
    const BITS *bits)

Synopsis

Writes the bitstring to the specified file stream. To read the bitstring, use the bits fget() function. The structure of the bitstring is:

Source Code - (sflbits.c)

{
    int
        block_nbr;                      /*  Bitstring block number           */
    word
        comp_size;                      /*  Size of compressed block         */
    BITBLOCK
        *block_ptr;                     /*  Points to bitstring block        */

    ASSERT (bits);
    ASSERT (file);

    /*  Write bitstring header to file                                       */
    fwrite (&bits-> block_count, sizeof (bits-> block_count), 1, file);
    fwrite (&bits-> free_list,   sizeof (bits-> free_list),   1, file);

    /*  Write bitstring blocks to file                                       */
    for (block_nbr = 0; block_nbr < bits-> block_count; block_nbr++)
      {
        block_ptr = bits-> block [block_nbr];
        comp_size = compress block ((byte *) block_ptr,
                                    compressed, (word) block_ptr-> size);

        fwrite (&comp_size, sizeof (comp_size), 1, file);
        fwrite (compressed, comp_size,          1, file);
      }
    return 0;
}

| << | < | > | >> iMatix Copyright © 1996-2000 iMatix Corporation