Hi,
I have an app that works with Visual Studio 2010, but not with VS2015.
Its purpose is to redirect stdout to a thread that reads from a pipe created with:
if (FALSE == CreatePipe(&pipeout, &pipein, &sec, 0))
{ mes = strdupa("SCRIPT: Unable to create pipe");
goto err;
}
SetStdHandle(STD_OUTPUT_HANDLE, pipein);
hCrt = _open_osfhandle((intptr_t)pipein, _O_TEXT|_O_APPEND );
hf = _fdopen(hCrt, "r");
*stdout = *hf;
The child thread reads the pipe with:
char c;
int rr;
OVERLAPPED ov;
for(;;)
{ bzero((char *)&ov, sizeof(OVERLAPPED));
if (FALSE == ReadFile(pipeout, &c, 1, &rr, &ov ))
{ char *mes = wgle();
ExitThread(1);
}
If the main threads does either:
write(fileno(stdout), "test\n", 5);
WriteFile(pipein, "test2\n", 6, &flag, NULL);
the child reads these 2 strings with VS2010, but only the second with VS2015.
What I am doing wrong?
Thanks for any help...