www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - How do you open a second console? I have multiple streams of info I

reply Enjoys Math <enjoysmath gmail.com> writes:
Hi,

I tried googling and didn't find anything.

I have thread doing a time-intensive search and I want its 
results printed to a second console while the main console 
displays what I already have writing.

Thanks.
Nov 13 2017
parent reply Jonathan M Davis <newsgroup.d jmdavisprog.com> writes:
On Monday, November 13, 2017 19:58:51 Enjoys Math via Digitalmars-d-learn 
wrote:
 Hi,

 I tried googling and didn't find anything.

 I have thread doing a time-intensive search and I want its
 results printed to a second console while the main console
 displays what I already have writing.

 Thanks.
When something displays to the console, it's by the program writing to stdout or stderr. Then by default, the console displays that output (though it could be redirected to a file or pipe or whatnot). So, the program itself isn't even in control of sending data to the console it's running in, let alone another console. It just sends the data to stdout. Probably the simplest way to get data displaying on a second console is to write the data to a file and then tail -f the file in the other console. - Jonathan M Davis
Nov 13 2017
parent Enjoys Math <enjoysmath gmail.com> writes:
On Monday, 13 November 2017 at 20:24:38 UTC, Jonathan M Davis 
wrote:
 On Monday, November 13, 2017 19:58:51 Enjoys Math via 
 Digitalmars-d-learn wrote:
 Hi,

 I tried googling and didn't find anything.

 I have thread doing a time-intensive search and I want its 
 results printed to a second console while the main console 
 displays what I already have writing.

 Thanks.
When something displays to the console, it's by the program writing to stdout or stderr. Then by default, the console displays that output (though it could be redirected to a file or pipe or whatnot). So, the program itself isn't even in control of sending data to the console it's running in, let alone another console. It just sends the data to stdout. Probably the simplest way to get data displaying on a second console is to write the data to a file and then tail -f the file in the other console. - Jonathan M Davis
I came up with an alternative solution. Having a command line option to show the second stream: while(true) { auto line = readln(); if (line) { if (line == "quit") return; else if (line == "dbg matrix") yoda.setShowMatrix(true); else if (line == "stop dbg") yoda.setShowMatrix(false); else if (line == "restart") yoda.start(); } Thread.sleep(dur!"msecs"(100)); }
Nov 13 2017