I want my_custom_print() output to appear on console. But if the program's stderror or stdout is redirected from shell, they should get redirected (as normal), but the output from my_custom_print() should get ignored.
Is it possible to write my_custom_print() satisfying above condition ? If possible, how?
You can try opening /dev/tty, but it doesn't necessarily exist, if your program run from the environment with no tty.
Maybe isatty or /dev/tty could be useful to you.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With