If this code executed while debugging, then maybe stopped at there without terminated.
But if this code executed while not debugging but still debug mode, then the program will be terminated.
I'm not sure what you mean by not debugging but still in debug mode. Are you saying that you compiled a debug version of the software but may or may not be running through a debugger?
In that case, if you want to stop at this line, simply put a breakpoint there. When you run it through the debugger, the code will stop at that point.
And, based on what you stated, you probably don't even need any of the code you showed. Simply put the breakpoint on the next line. Your debugger will stop right before that line is executed.
yes, I meant about running with a debugger. I know when the program(run through a debugger) meets the __debugbreak() line, the program will be stopped at the line instead terminated.
but if the program run without a VS debugger, the program will be terminated instead stopped. Right?
I want a effect of __debugbreak in the program which run through a debugger.
but I don't want a effect of __debugbreak in the program which doesn't run through a debugger.