Saving color when redirecting output from stdout and stderror in C #

I end the command line process in the WinForms application and redirect the output so that it can be passed to the RTF control or to the list. It would be nice to keep the foreground color of the text as it appears so that it can display correctly in the form. Is there any way to do this?

+3
source share
1 answer

Probably not. Console color output is accomplished by calling the SetConsoleTextAttribute API , which runs on the buffers of the console screen.

, . SetConsoleTextAttribute ( ), , , .

+2

Source: https://habr.com/ru/post/1727062/


All Articles