Program doesn't stop after exception

后端 未结 6 805
悲哀的现实
悲哀的现实 2021-01-21 03:11

I am using eclipse in Ubuntu 12.04. I use some exceptions in my program and when they are caught it gives me cout correctly. But the program continues to the end. Is there a way

6条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-01-21 04:09

    Use the function exit: exit(1);, where 1 is the exit code (normally non-zero signals an error). You can use also abort() if you consider the exception as critical error.

提交回复
热议问题