How can we know the name of the stream to which output is being redirected through a C++ program?
For example, I have a program 1.cpp whose output is being redirected to a file a.txt
i.e., a.out > a.txt
Now, I want to know the name of the file to which output is being redirected in the program itself.
How can I do that?
Thanks in advance.