View Full Version : R/W on files in a directory by i-number

07-26-2005, 09:38 AM
I am working with some Unix system calls, and I want to be able to open a directory, and perform read/write operations on the files in that directory.

I already know that I can open a directory, then call readdir() to put the i-number and name in a struct.

So....the question is, can I perform read/write on files with just the i-number?

Not looking for exact code, just pointers (hah) in the rightr direction.

EDIT: so really what I need to do is get a file descriptor from a i-number.

jim mcnamara
07-26-2005, 10:58 AM
I must be missing something - struct dirent already has a file name.

AFAIK -- All of the file open routines use only file names - open, fopen.

If you need to use only the i-node number, then you'll have to get your kernel's source for the file system and see how file descriptors are created.