Thread overview
'write' crashes without extra window
Oct 07, 2014
Joel
Oct 08, 2014
AsmMan
Oct 08, 2014
Adam D. Ruppe
Oct 08, 2014
Joel
Oct 08, 2014
Gary Willoughby
Oct 08, 2014
Sag Academy
Oct 08, 2014
Kagamin
October 07, 2014
I have a program that runs at Windows 7 login, each time. But it had been opening with a command prompt, so I got rid of the prompt and now it some times crashes. I've noticed it before, using 'write' without the prompt.
October 08, 2014
On Tuesday, 7 October 2014 at 23:41:14 UTC, Joel wrote:
> I have a program that runs at Windows 7 login, each time. But it had been opening with a command prompt, so I got rid of the prompt and now it some times crashes. I've noticed it before, using 'write' without the prompt.

Can you post the code and the error message (from crash) you're getting?
October 08, 2014
On Tuesday, 7 October 2014 at 23:41:14 UTC, Joel wrote:
> it had been opening with a command prompt, so I got rid of the prompt and now it some times crashes.

That's a feature - writing to a non-existent handle fails, so it throws an exception. (The reason you don't notice this in something like C is you prolly don't check printf's return value...)

You could just wrap the write function in a try/catch to explicitly ignore the error.

October 08, 2014
On Wednesday, 8 October 2014 at 03:33:38 UTC, Adam D. Ruppe wrote:
> On Tuesday, 7 October 2014 at 23:41:14 UTC, Joel wrote:
>> it had been opening with a command prompt, so I got rid of the prompt and now it some times crashes.
>
> That's a feature - writing to a non-existent handle fails, so it throws an exception. (The reason you don't notice this in something like C is you prolly don't check printf's return value...)
>
> You could just wrap the write function in a try/catch to explicitly ignore the error.

Thanks Adam.
October 08, 2014
On Wednesday, 8 October 2014 at 03:33:38 UTC, Adam D. Ruppe wrote:
> You could just wrap the write function in a try/catch to explicitly ignore the error.

Or if the write function is there only for debug purposes you could wrap it in a debug/version block.

http://ddili.org/ders/d.en/cond_comp.html
October 08, 2014
On Wednesday, 8 October 2014 at 09:17:01 UTC, Gary Willoughby
wrote:
> On Wednesday, 8 October 2014 at 03:33:38 UTC, Adam D. Ruppe wrote:
>> You could just wrap the write function in a try/catch to explicitly ignore the error.
>
> Or if the write function is there only for debug purposes you could wrap it in a debug/version block.
>
> http://ddili.org/ders/d.en/cond_comp.html

Yeah, exactly man
October 08, 2014
Or open nul device in place of stdout (windows equivalent of /dev/null).