0

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?

2
Contributors
2
Replies
3
Views
7 Years
Discussion Span
Last Post by 42Wired
0

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.

0

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.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.