'write' crashes without extra window

Adam D. Ruppe via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Oct 7 20:33:37 PDT 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.



More information about the Digitalmars-d-learn mailing list