Demo code: "converting" Windows file HANDLE and C FILE* into C++ i/o stream. (WinAPI !!)
This code shows how to
- call a child MS Windows exe process and intercept its Std{In/Out/Err} (see winiostream.hpp);
- "convert" WinAPI in/out/err HANDLE into C FILE* and then into C++ i/o streams (see createproc.hpp).
C:\Users\user\calltest>g++ main-serv.cpp -o main-serv.exe
C:\Users\user\calltest>g++ -std=c++1z main.cpp -o caller.exe
C:\Users\user\calltest>caller
caller: Hello!
Child process 'greating': Here I am!
x=1 --> y=1
x=2 --> y=4
x=4 --> y=16
x=5 --> y=25
x=9 --> y=81
Task compleated.
caller: Bye!