Answer the question
In order to leave comments, you need to log in
How to make stdout redirected in WinAPI and stderr go nowhere?
I want to run a program through WinAPI channels that slightly "shit" in stderr. Therefore, I want the stderr stream to go nowhere, and stdout to a named pipe.
There is one bit in the STARTUPINFO structure - STARTF_USESTDHANDLES. Is it possible to make one of these three descriptors be null, or the buffer emptied on overflow, or something else - but only so that the program does not stop if the buffer overflows?
REPEAT FOR SYS ADMIN. Programming! Windows API! CreateProcess!
I know what 2>nul is. And what admin replaced “medium” complexity with “simple”: WinAPI is, in principle, not a trivial thing.
Answer the question
In order to leave comments, you need to log in
What language?
In C#, this is much easier to do, without the Win32API at all.
On the pluses, we look at the STARTUPINFO structure
typedef struct _STARTUPINFO {
DWORD cb;
LPTSTR lpReserved;
LPTSTR lpDesktop;
LPTSTR lpTitle;
DWORD dwX;
DWORD dwY;
DWORD dwXSize;
DWORD dwYSize;
DWORD dwXCountChars;
DWORD dwYCountChars;
DWORD dwFillAttribute;
DWORD dwFlags;
WORD wShowWindow;
WORD cbReserved2;
LPBYTE lpReserved2;
HANDLE hStdInput;
HANDLE hStdOutput;
HANDLE hStdError;
} STARTUPINFO, *LPSTARTUPINFO;
stderr stream went nowhere
2>NUL
WinAPI is, in principle, not a trivial thing.Maybe, but the detailed description is stdin, stdout, stderr .
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question