You can do what you are talking about, have one application create a second console window, so you can have one for input and one for output.
That said, it is not a trivial thing to do. In fact it would be a fair bit of work. On windows for example, you could use the Console APIs to accomplish this, but trust me, such a task is not something you probably want to embark on.
Basically what happens in C++ is each application has something called stdin and stdout. These are simply buffers for text input and output. Where the actual text goes is somewhat irrelevant to C++. When you use cout or cin, you are actually writing to or reading from stdin and stdout, at least by default. Problem is, by default a new terminal window means a new process, which means a new cin and cout. You can easily redirect stdout and stdin, say... to a file. But redirecting the results to another running application is much more complicated involving cross-process communications of some form, such as a pipe.
Show differencesHistory of post edits
#2Serapth
Posted 27 November 2012 - 03:32 PM
You can do what you are talking about, have on application create a second console window, so you can have one for input and one for output.
That said, it is not a trivial thing to do. In fact it would be a fair bit of work. On windows for example, you could use the Console APIs to accomplish this, but trust me, such a task is not something you probably want to embark on.
Basically what happens in C++ is each application has something called stdin and stdout. These are simply buffers for text input and output. Where the actual text goes is somewhat irrelevant to C++. When you use cout or cin, you are actually writing to or reading from stdin and stdout, at least by default. Problem is, by default a new terminal window means a new process, which means a new cin and cout. You can easily redirect stdout and stdin, say... to a file. But redirecting the results to another running application is much more complicated.
That said, it is not a trivial thing to do. In fact it would be a fair bit of work. On windows for example, you could use the Console APIs to accomplish this, but trust me, such a task is not something you probably want to embark on.
Basically what happens in C++ is each application has something called stdin and stdout. These are simply buffers for text input and output. Where the actual text goes is somewhat irrelevant to C++. When you use cout or cin, you are actually writing to or reading from stdin and stdout, at least by default. Problem is, by default a new terminal window means a new process, which means a new cin and cout. You can easily redirect stdout and stdin, say... to a file. But redirecting the results to another running application is much more complicated.
#1Serapth
Posted 27 November 2012 - 03:21 PM
You can do what you are talking about, have on application create a second console window, so you can have one for input and one for output.
That said, it is not a trivial thing to do. In fact it would be a fair bit of work.
That said, it is not a trivial thing to do. In fact it would be a fair bit of work.