Comment maybe writing directly to the device files? (Score 0) 578
of course this way you can only work with bytes instead of bits, but that's just a mathematical problem, you can solve this with some bit-shifting.
int base2[] = {128, 64, 32, 16, 8, 4, 2, 1};
bool getbit(FILE* device, int num) {
fseek(device, num/8, SEEK_SET);
return (fgetc(device) / base2[num%8]) % 2;
}
void setbit(FILE* device, int num, bool bit) {
fseek(device, num/8, SEEK_SET);
char tmp = fgetc(device);
fseek(device, num/8, SEEK_SET);
int basenm8 = base2[num % 8];
fputc(device, (((tmp/(2*basenm8))*2 + bit)*basenm8) + tmp%basenm8 );
}
or something like that...