Re: disabling and enabling console output

2019-05-16 Thread Alex via Digitalmars-d-learn
On Thursday, 16 May 2019 at 17:49:24 UTC, Adam D. Ruppe wrote: On Thursday, 16 May 2019 at 14:53:14 UTC, Alex wrote: I have some code that disables the console because some other code puts junk on it that I don't want to see s stupid question but can't you just edit the other code to not

Re: disabling and enabling console output

2019-05-16 Thread Adam D. Ruppe via Digitalmars-d-learn
On Thursday, 16 May 2019 at 14:53:14 UTC, Alex wrote: I have some code that disables the console because some other code puts junk on it that I don't want to see s stupid question but can't you just edit the other code to not put junk on it? Maybe there is some other approach we can try

Re: disabling and enabling console output

2019-05-16 Thread Vladimir Panteleev via Digitalmars-d-learn
On Thursday, 16 May 2019 at 17:42:17 UTC, Alex wrote: I'm not sure if they are failing to block or if they are blocking what is being opened(and not the original console). That is, do I need to not open and simply close stdout? Yes, I see. It won't work because the two libraries are using dif

Re: disabling and enabling console output

2019-05-16 Thread Alex via Digitalmars-d-learn
On Thursday, 16 May 2019 at 17:19:13 UTC, Vladimir Panteleev wrote: On Thursday, 16 May 2019 at 17:18:01 UTC, Alex wrote: adding int dup(int) @trusted; int dup2(int, int) @trusted; int close(int) @trusted; int open(in char*, int, ...) @trusted; Be sure to make

Re: disabling and enabling console output

2019-05-16 Thread Vladimir Panteleev via Digitalmars-d-learn
On Thursday, 16 May 2019 at 17:18:01 UTC, Alex wrote: adding int dup(int) @trusted; int dup2(int, int) @trusted; int close(int) @trusted; int open(in char*, int, ...) @trusted; Be sure to make them extern(C). Sorry, I haven't tried it, I'm guessing that it shou

Re: disabling and enabling console output

2019-05-16 Thread Alex via Digitalmars-d-learn
On Thursday, 16 May 2019 at 17:07:39 UTC, Vladimir Panteleev wrote: On Thursday, 16 May 2019 at 17:05:01 UTC, Alex wrote: One thing you could try is going one level lower, and using dup() to save the stream to another fd, close() to close the stdout one, and dup2() to restore the saved fd over

Re: disabling and enabling console output

2019-05-16 Thread Alex via Digitalmars-d-learn
On Thursday, 16 May 2019 at 15:21:48 UTC, Vladimir Panteleev wrote: On Thursday, 16 May 2019 at 14:53:14 UTC, Alex wrote: I have some code that disables the console because some other code puts junk on it that I don't want to see... then I enable it. One thing you could try is going one level

Re: disabling and enabling console output

2019-05-16 Thread Vladimir Panteleev via Digitalmars-d-learn
On Thursday, 16 May 2019 at 17:05:01 UTC, Alex wrote: One thing you could try is going one level lower, and using dup() to save the stream to another fd, close() to close the stdout one, and dup2() to restore the saved fd over the stdout one. Unfortunately D doesn't seem to have dup, dup2.

Re: disabling and enabling console output

2019-05-16 Thread Vladimir Panteleev via Digitalmars-d-learn
On Thursday, 16 May 2019 at 14:53:14 UTC, Alex wrote: I have some code that disables the console because some other code puts junk on it that I don't want to see... then I enable it. One thing you could try is going one level lower, and using dup() to save the stream to another fd, close() to