hwBinary - utilities to read and write HoverWare objects from binary files
#include "hw.h"
hwInt32 hwBeginBinary( hwObjRW oRdWr, void *f, hwInt32 flags, hwInt32 *numObj )
hwInt32 hwEndBinary( hwObjRW oRdWr, void *f )
hwInt32 hwWriteBinary( hwObject obj, hwObjRW oWrite, void *f )
hwInt32 hwReadBinary( hwObjRW oRead, void *f, hwInt32 numObjs, hwObject **objs )
The hwBinary utilities can read and write binary HoverWare object files. Note that the interface is abstracted such that these binary files can actually be memory buffers for transmission over sockets:
FILE
*f;
hwInt32
numObjs;
hwObject
*objs;
f = fopen("filename.hwb", "rb");
if( !f ) {
/* Error */
}
if( !hwBeginBinary( (hwObjRW)fread, inFile, HW_FILE_READ_HDR, &numObjs ) ) {
/* Error */
}
if( hwReadBinary( (hwObjRW)fread, inFile, numObjs, &objs ) != numObjs ) {
/* Error */
}
if( !hwEndBinary( (hwObjRW)fread, inFile ) ) {
/* Error */
}
fclose( f );
/* We now have numObjs objects in the objs array */