Is there a way to redirect stdout with low level API... haven't found a function or a way to actually do this....
The dup system call should let you redirect stdout, as shown in this example.
freopen also will work, if you're redirecting to a file, but dup can also be used
with pipes and sockets.
I believe dup2(fd,1) does the trick, e.g. after opening fd using open().
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