Share via

Can vs2019 have two console program windows?

洋 李 1 Reputation point
2020-10-30T08:25:40.977+00:00

I want to have two console program windows, or in other words, I want to display the input and output of the program separately. For Example: ![36237-example.png][1] [1]: /api/attachments/36237-example.png?platform=QnA

Developer technologies | Visual Studio | Debugging
0 comments No comments

1 answer

Sort by: Most helpful
  1. RLWA32 52,551 Reputation points
    2020-10-30T09:32:01.973+00:00

    A process can have only one associated console. This is documented here - allocconsole. If you want to use more than one console window you will need to create another process and then use some form of inter-process communication (e.g., pipes) to communicate between them. For example, the initial process can use its own console to receive user input and then sends output to the other process through a pipe. The receiving process reads data from the pipe and displays it on its own console.

    For a working sample see Multiple-consoles-for-a-single-application

    Was this answer helpful?


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.