What I am trying to do is to write a C program on linux which should be checking in the current directory if there are sparse files, and also I would like to print the number of disk blocks that already represent gaps in the file and the number of disk blocks that are 0-filled but take up disk space.
So far I can access the current directory and print just the files with
DIR *dirp;
struct dirent *dp;
To get done the second part with sparse file I tried to use stat()
but it seems not to be working because I don't get the required results as I wished.
So, could anyone show me how to do the part with the sparse file?