Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how can i get a files block numbers with its inode?

Status
Not open for further replies.

karmafree

Programmer
May 10, 2001
107
GB
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( &quot;File size = %ld bytes\n&quot;, buffer.st_ino );
printf(&quot;\n&quot;);
}

i know i have to do something with the inode number but what? and how?


thanks in advanced!
karmafree@
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top