Greetings. My goal is to obtain individual bits within a byte with C. The reason is to develope and experiments with some encryption schemes. Now I know that we can read a bytesize from fread and fwrite, but i want the individual bits of it, one option would be to use the >> and << bitwise operators with a mask bit pattern or a modulation operator, but that is quite inefficient i think when dealing with large files. I would be obliged if anybody can guide to any alternative approach to this problem. Thanks in advance.

here is the code i have used for getting bits out of a byte, currently its for a character inputted through keyboard, but it can be adopted with any I/O by converting it the other way around, but as i said i think there must be some more proficient method of doing it.

Code:
#include<stdio.h>
#include<conio.h>

void main()
{
	int bits[8];
	int b;
	int cnt=7;
	char ch;
	clrscr();
	printf(" Enter a value or character ");
	scanf("%c",&ch);
	clrscr();
	while(cnt>=0)
	{
		b=ch%2;
		bits[cnt]=b;
		a=a/2;
		cnt--;
	}


	for(cnt=0;cnt<8;c++)
		printf("%d",bits[cnt]);
	getch();
}