Library for structured binary data I/O
BDIO lib Documentation

Introduction

This library provides tools for reading, writing and manipulating bdio files (bdio.pdf). These are binary files, structured into records, which contain a thin layer of meta-data each. This meta-data allows to keep the files machine independent and browsable, while maintaining the advantages of raw binary I/O, i.e. minimal file-size and decent speed.

Dependencies

The library should compile on standard UNIX systems with standard C99 compilers.
It depends on the standard C library, in particular

Furthermore the C POSIX library is needed

Compilation

Examples

A very simple application is ex0.c

/* ex0.c
*
* A minimal bdio example
*
* Tomasz Korzec 2014
******************************************************************************/
#include <bdio.h>
#include <stdlib.h>
int main(int argc, char *argv[])
{
BDIO *fh;
int x[5] = {1,2,3,4,5};
/* open bdio file for writing */
fh = bdio_open( "ex0.bdio", "w", "protocol info goes here" );
/* start a integer record with user-info 0 and native endianness */
/* write 5 integers twice (5*32bit = 20 byte) and close the BDIO file */
bdio_write_int32( x, 20, fh );
bdio_write_int32( x, 20, fh );
bdio_close( fh );
/* open bdio file for reading */
fh = bdio_open( "ex0.bdio", "r", NULL );
/* move file pointer to the beginning of the first record */
/* read two integers from the file, store them in x, and close the file */
bdio_read_int32( x, 8, fh );
bdio_close( fh );
return( EXIT_SUCCESS );
}

Further simple programs using bdio can be found here