I'm writing a GUI program on Windows which needs to call some functions implemented in an external C library. Unfortunately, these functions print out messages into stdout and stderr then I need to redirect/capture them to my own handler.
There are severalhelps and they are around using open_osfhandle to redirect stdout and stderr to Windows's HANDLE.
But I still don't know how to obtain these C's IO handler in Rust. Many thanks for any help.
Thank you, but the problem is how to access stdin/out/err. They are IO handlers create by Windows CRT, I found that they are defined in corecrt_wstdio.h as: