hi, i am trying to write a c program that lists a files associated block numbers and inode numbers. the filename is passed as a command line parameter.
So far i have managed to get the inode number but i also need the block numbers. how do i do this? am using the unix/minix file system.
my code:
#include <sys/types.h>
#include <sys/stat.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <dirent.h>
void main(int argc, char *argv[])
{
struct stat buffer;
stat(argv[1], &buffer);
printf( "File size = %ld bytes\n", buffer.st_ino );
printf("\n"
}
i know i have to do something with the inode number but what? and how?
thanks in advanced!
karmafree@
So far i have managed to get the inode number but i also need the block numbers. how do i do this? am using the unix/minix file system.
my code:
#include <sys/types.h>
#include <sys/stat.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <dirent.h>
void main(int argc, char *argv[])
{
struct stat buffer;
stat(argv[1], &buffer);
printf( "File size = %ld bytes\n", buffer.st_ino );
printf("\n"
}
i know i have to do something with the inode number but what? and how?
thanks in advanced!
karmafree@