#include #include #include int main(int argc, char **argv) { int fd; long count, recv; unsigned char *buf,*tmp_uchptr; int k; long check = 0; unsigned char tmp_uchar; if(argc>1) count = strtol(argv[1],NULL,10); else { fprintf(stderr,"Use %s number_of_bits_you_want_to_read\n",argv[0]); fprintf(stderr," %s %d # for example, reads 1000 bits\n",argv[0],1000); fprintf(stderr," usually there's approx. 700 bits read\n"); fprintf(stderr," so a buffer of 1000 is more than enough\n"); exit(0); } buf = (unsigned char *) malloc(count*sizeof(unsigned char)); if(!buf){ fprintf(stderr,"malloc\n"); exit(1); } fd = open("/dev/paraseat0", O_RDWR); if(fd == -1) { fprintf(stderr, "Error: could not open /dev/paraseat0 for reading.\n"); exit(1); } recv = read(fd,buf,count); close(fd); // fprintf(stderr,"%lu bits requested; %lu bits read\n",count,recv); tmp_uchptr = buf; for (k=0;k