[LCP]getting the filename from a *FILE variable

Greg Black gjb at gbch.net
Wed Jan 12 13:21:02 UTC 2005


On 2005-01-11, Karthik Vishwanath wrote:

> I have files parsed from the command line in a program that are
> opened using (fp = fopen()), where fp is defined as FILE *fp; 
> 
> Is there a function that will give me the filename of the fopen'd file
> using fp?

No.  Remember it yourself, since you have to know it to call
fopen(3) in the first place.

Cheers, Greg




More information about the linuxCprogramming mailing list