[Subject Prev][Subject Next][Thread Prev][Thread Next][Subject Index][Thread Index]

Re: Inode



If u don't want to implement recursive search, then there is function
provided by Unix (Not sure of Linux) 'ftw' (File tree Walk). u can use
it and it will traverse the file tree recursively. The required header
is <ftw.h>. For detailed info give man ftw.

Sunix.

Binand Raj S. wrote:
> In a shell script, find is fine. But in a C program, implementing find will be
> faster than using find in the program. I suggest you go to the beginning of
> the directory tree from where you want to search from (the syscall chdir()),
> use opendir() and readdir() recursively, and use stat() on all the entries in
> the directory. Compare stat_buf.st_ino with the inode number you have. Then
> fopen() the file and do whatever you want with it. Don't forget to closedir()
> the directory.
> 
> This is going to be a nice exercise in recursive programming using C.
> 
> The required headers are sys/types.h, sys/stat.h, dirent.h and stdio.h and
> possibly other headers.
> 
> Please followup to linux-india-programmers, as I feel this is more on topic
> there. I have crossposted this reply there.
> 
> Regards,
> 
> Binand
- -- 
"it is not the style of clothes one wears, neither the kind of
automobile one drives, nor the amount of money one has in the
bank, that counts. These mean nothing. It is simply service that
measures success."
                  Dr. George Washington Carver.

- --------------------------------------------------------------------
For more information on Linux in India visit http://www.linux-india.org/
Linux India is NOT a forum for Microsoft/India/Pakistan/US/UK bashing.
Flame baits will not be tolerated.  If you can appreciate satire read
http://www.templetons.com/brad/emily.html

------------------------------