I have a Visual C++ program that I use simply for audio recording and sometimes it totally out of the blue crashes and a dialog box comes up, "Visual C++ Debugging Library" "Debug Assertion Failed" "Abort","Retry","Ignore".
I have no need at all to do Retry or Ignore, so I just want Abort to be run automatically.
I have a batch/bash file that runs to detect that the program ended and to restart it, but when this dialog 开发者_开发技巧comes up, the program still runs and the program just remains crashed until I notice it.
The runtime function _set_error_mode()
can arrange this for you. You just need to do this:
_set_error_mode(_OUT_TO_STDERR);
All errors (including those provoked by assertion failures) will print their messages to stderr
rather than an interactive message box. This means that your application won't block waiting for input and will proceed to terminate itself immediately.
精彩评论