Utility with unredirectable output (Windows)

前端 未结 1 1546
予麋鹿
予麋鹿 2020-12-03 15:52

I am using a Microsoft command-line utility to perform a task. The specific details of what the utility does and the task it performs are, I think, relatively unimportant.

相关标签:
1条回答
  • 2020-12-03 16:40

    There's nothing particularly magical about it. Although the C library defaults to sending output to the standard output handle, there's no obligation for a program to do so; you can always open your own handle to the console output device (CONOUT$) instead.

    See the documentation on CreateFile for more information about console devices.

    In terms of capturing the output, you may be able to do something with ReadConsoleOutput and friends, but it isn't straightforward.

    0 讨论(0)
提交回复
热议问题