Here's my problem :
i have a structure, defined as follows:
(yes, i know i still have 1 bit to play with, just don't need it)Code:#define MAPSIZE 14 struct node { unsigned short leftMap :MAPSIZE; // map to left input unsigned short rightMap :MAPSIZE; // map to right input unsigned short leftValue :1; // left value = 0 || 1 unsigned short rightValue :1; // right value = 0 || 1 unsigned short out :1; // output of node };
and an array of these nodes. i want to be able to store this array on disk in just as little space as i do in memory(32 bits*numNodes). is there any slick way to write/read it, such as
or do i have to go about writing read/write functions that will pack an unsigned short and write that to disk? thanks.Code:nodes[i] >> out; // to write out >> nodes[i]; // to read
--paul




Reply With Quote