* (e-mail address removed):
ostream& operator<<(ostream& o, const bdd& d) {
I want to Print file name here. How can I get file name from o ?
}
As others have stated you cannot.
What's more, you cannot portably retrieve the underlying file handle,
even in the case where the ostream represents a file.
And even if you use some non-portable way to obtain the file handle
(assuming a file, and ostream functionality being implemented in terms
of something based on file handles), with a modern OS there may be no
way to obtain a unique filename, because a file may have more than one
name. E.g., that's the case in Unix-based OSes and in modern Windows.
However, it might be possible to obtain the name used to originally open
the file handle.
Upshot: if you need the/a file name, you need to let your own code
remember it.
No such thing as 'void main' in C or C++, and never has been.