‎03-28-2007 01:25 PM
‎03-29-2007 02:38 AM
‎04-02-2007 12:02 PM
‎04-03-2007 03:50 AM
The minimum amount of data that a C file read/write operation can transfer is one byte. For your application to examine a 32 bit header bit by bit, I would probably use code along the following lines:
#define BIT_SET(word, bit) ((word) & 1 << (bit) ? 1: 0)
...
FILE *fp;
unsigned int header;
...
fp = fopen (filepath, "rb");
fread (&header, sizeof (unsigned int), 1, fp); // Read 32 bits into 1 word
...
if (BIT_SET (header, 14)) { // Test if bit 14 of the header is set
// Do stuff for bit 14 set
} else {
// Do stuff for bit 14 clear
}
// etc
JR
‎04-04-2007 08:20 AM
‎04-04-2007 10:25 AM