file descriptors --> filenames
guyton%rand-unix at sri-unix.UUCP
guyton%rand-unix at sri-unix.UUCP
Mon Feb 27 15:30:00 AEST 1984
From: James_Guyton <guyton at rand-unix>
The only "practical" way of doing this is to hang onto the
filename yourself when you do the open (and forget it when
you close).
This isn't a general solution for Unix programs (since you
can be passed open files via stdin, stdout, stderr, pipes,
etc.), but if you're converting a pgm from RSX, that
shouldn't be a problem for you. You might also run into
problems if the program ever changes its current working
directory after an open.
I suggest having an array of strings indexed by the real
file descriptor ("fileno" of the FILE argument). Use the
variable NOFILE out of <sys/param.h> for the size of the
array.
-- Jim
More information about the Comp.unix
mailing list