"Alvaro Puente" <al********************@ece.ericsson.se> wrote in message
news:be**********@newstree.wise.edt.ericsson.se...
Hi all!
I've got a FILE* pointing to an already opened file.
I want to create a new file in the same directory where
that file is.
Is there any way of obtaining file path from FILE*?
From the C FAQ:
19.15: How can I recover the file name given an open stream or file
descriptor?
A: This problem is, in general, insoluble. Under Unix, for
instance, a scan of the entire disk (perhaps involving special
permissions) would theoretically be required, and would fail if
the descriptor were connected to a pipe or referred to a deleted
file (and could give a misleading answer for a file with
multiple links). It is best to remember the names of files
yourself as you open them (perhaps with a wrapper function
around fopen()).
--
C-FAQ:
http://www.eskimo.com/~scs/C-faq/top.html
"The C-FAQ Book" ISBN 0-201-84519-9
C.A.P. FAQ:
ftp://cap.connx.com/pub/Chess%20Anal...ject%20FAQ.htm