#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <stdio.h>
Go to the source code of this file.
Functions | |
unsigned int | CountFreeBits (const int byte) |
unsigned int | CountnFree (char m_BitMap) |
int | main (int argc, char *argv[]) |
unsigned int CountFreeBits | ( | const int | byte | ) |
Definition at line 24 of file readMetaRoot.c.
unsigned int CountnFree | ( | char | m_BitMap | ) |
Definition at line 37 of file readMetaRoot.c.
00038 { 00039 // Count number of free bits in bitmap 00040 unsigned int count; 00041 00042 count = CountFreeBits( m_BitMap ); 00043 return count; 00044 }
int main | ( | int | argc, | |
char * | argv[] | |||
) |
Definition at line 46 of file readMetaRoot.c.
00047 { 00048 int file, i; 00049 char c; 00050 unsigned int sum; 00051 00052 for( i = 1; i < argc; i++ ) 00053 { 00054 file = open( argv[ i ], O_RDONLY ); 00055 if( file > 0 ) 00056 { 00057 sum = 0; 00058 while( read( file, (char *)&c, 1 ) == 1 ) 00059 { 00060 sum += CountnFree( c ); 00061 } 00062 close( file ); 00063 fprintf( stderr, "sum = %u\n", sum ); 00064 } 00065 else 00066 fprintf( stderr, "Nao consegui abrir o arquivo\n" ); 00067 } 00068 00069 return( 0 ); 00070 }