'write' crashes without extra window

Joel via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Oct 7 22:56:12 PDT 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.


More information about the Digitalmars-d-learn mailing list