PDA

View Full Version : Counting Bits from a FILE in C


uniquity
04-18-2010, 08:23 PM
I'm trying to open a file and count the number of BITS in the file...does anyone have any suggestions on how to do this? I was thinking about setting my bit count variable to the return value of the fread(3) function but I'm not sure if the return value for that function is what I'm looking for. If anyone has any suggestions on how to do this, it would be greatly appreciated, thanks in advance.

oracleguy
04-18-2010, 10:32 PM
Read the number of bytes and multiply by 8. You don't even necessarily need to open the file, just look at the file size.