I'm trying to open a file (ifstream object), read from the file, then pass the ifstream object to a function where it will continue reading from the file. Along the way, I want to store the path of the file, and would like to know if there is a way to retrieve the path of the file from the ifstream object using public member functions. I didn't see any way to do this here, but I thought maybe someone here knows a trick to get around that (if it does, indeed, store the path).

I know I can always pass the path as another argument, but I would like to avoid doing so because it would mean I would have to change the scope of a class or two. Any ideas?

Not likely to keep the path or filename because it is only needed to pass along to the operating system so that it can open the file and return the handle to fstream. You could subclass fstream so that it saves that information.

This is for work, so I'd rather not create more files in the baseline. I'll just have to do it the hard way. Thanks, anyway.