I want redirect output console program to memory. It can be specified memory buffer, or buffer that I can gert ptr to later. I need to specifiy input and output of program and can do this with tmp file+redirect I/O, but that expensive operations+invloves tmp files. I know redirect output to socket
startinfo.dwFlags = STARTF_USESHOWWINDOW | STARTF_USESTDHANDLES;
startinfo.hStdInput = sockfd;
startinfo.hStdOutput = sockfd;
startinfo.hStdError = sockfd;
CreateProcess(0, "cmd.exe", NULL, NULL, TRUE, DETACHED_PROCESS, 0, 0, &startinfo, &pinfo);
How do I redirect to memory?
also would like redirect input+err if possible