digitalmars.D.learn - 'write' crashes without extra window
- Joel (4/4) Oct 07 2014 I have a program that runs at Windows 7 login, each time. But it
- AsmMan (3/7) Oct 07 2014 Can you post the code and the error message (from crash) you're
- Adam D. Ruppe (7/9) Oct 07 2014 That's a feature - writing to a non-existent handle fails, so it
- Joel (2/11) Oct 07 2014 Thanks Adam.
- Gary Willoughby (4/6) Oct 08 2014 Or if the write function is there only for debug purposes you
- Sag Academy (3/10) Oct 08 2014 Yeah, exactly man
- Kagamin (2/2) Oct 08 2014 Or open nul device in place of stdout (windows equivalent of
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.
Oct 07 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?
Oct 07 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.
Oct 07 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:Thanks Adam.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.
Oct 07 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
Oct 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:Yeah, exactly manYou 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
Oct 08 2014
Or open nul device in place of stdout (windows equivalent of /dev/null).
Oct 08 2014