Is it possible to get HANDLE
referring to standard error output that could be written with WriteFile
on Windows?
The reason I am asking is that I am writing some logging utilities for me. And I am trying to give the data directly to system to:
- avoid any potential problems with things not being flushed and
- let the system interleave messages from separate threads without need for locking (if that actually works is the other question).
The application is otherwise windows subsystem, so it should only write anywhere if the application actually inherited standard error? If that's possible, that is.
NOTE: I already have log sink to OutputDebugString
. And it's equivalents for several other platforms. And to file, which uses low-level API to avoid any additional buffering (as the message is already assembled in on-stack buffer and needs to be flushed immediately). And I just want to reuse the code for writing file for writing on standard error too.