Skip to content

Commit 8d1f55a

Browse files
author
Colin Robertson
authored
Fix several broken links, noted in bug 545978. (#497)
* Fix several broken links * More md lint of touched files * Fix some formatting. * Fix toi wording * changed fwlinks to site relative (MicrosoftDocs#504) * replaced fwlinks with site relative links (MicrosoftDocs#505) We should use these if they work on review.docs
1 parent 047785d commit 8d1f55a

File tree

11 files changed

+3203
-3184
lines changed

11 files changed

+3203
-3184
lines changed
Lines changed: 94 additions & 93 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: "abort | Microsoft Docs"
33
ms.custom: ""
4-
ms.date: "11/04/2016"
4+
ms.date: "1/02/2018"
55
ms.reviewer: ""
66
ms.suite: ""
77
ms.technology: ["cpp-standard-libraries"]
@@ -13,102 +13,103 @@ apitype: "DLLExport"
1313
f1_keywords: ["Abort"]
1414
dev_langs: ["C++"]
1515
helpviewer_keywords: ["aborting current process", "abort function", "processes, aborting"]
16-
ms.assetid: a797783b-40ed-4bdb-a2cd-14ffede39e8a
17-
caps.latest.revision: 24
1816
author: "corob-msft"
1917
ms.author: "corob"
2018
manager: "ghogen"
2119
ms.workload: ["cplusplus"]
2220
---
2321
# abort
24-
Aborts the current process and returns an error code.
25-
22+
23+
Aborts the current process and returns an error code.
24+
2625
> [!NOTE]
27-
> Do not use this method to shut down a [!INCLUDE[win8_appname_long](../../build/includes/win8_appname_long_md.md)] app, except in testing or debugging scenarios. Programmatic or UI ways to close a [!INCLUDE[win8_appname_long](../../build/includes/win8_appname_long_md.md)] app are not permitted according to the [Windows 8 app certification requirements](http://go.microsoft.com/fwlink/p/?linkid=262889). For more information, see [Application lifecycle (Windows Store apps)](http://go.microsoft.com/fwlink/p/?linkid=262853).
28-
29-
## Syntax
30-
31-
```
32-
void abort( void );
33-
```
34-
35-
## Return Value
36-
`abort` does not return control to the calling process. By default, it checks for an abort signal handler and raises `SIGABRT` if one is set. Then `abort` terminates the current process and returns an exit code to the parent process.
37-
38-
## Remarks
39-
**Microsoft Specific**
40-
41-
By default, when an app is built with the debug runtime library, the `abort` routine displays an error message before `SIGABRT` is raised. For console apps running in console mode, the message is sent to `STDERR`. Windows desktop apps and console apps running in windowed mode display the message in a message box. To suppress the message, use [_set_abort_behavior](../../c-runtime-library/reference/set-abort-behavior.md) to clear the `_WRITE_ABORT_MSG` flag. The message displayed depends on the version of the runtime environment used. For applications built by using the most recent version of Visual C++, the message resembles this:
42-
43-
`R6010`
44-
45-
`- abort() has been called`
46-
47-
In previous versions of the C runtime library, this message was displayed:
48-
49-
"`This application has requested the Runtime to terminate it in an unusual way. Please contact the application's support team for more information.`"
50-
51-
When the program is compiled in debug mode, the message box displays options to **Abort**, **Retry**, or **Ignore**. If the user chooses **Abort**, the program terminates immediately and returns an exit code of 3. If the user chooses **Retry**, a debugger is invoked for just-in-time debugging, if available. If the user chooses **Ignore**, `abort` continues normal processing.
52-
53-
In both retail and debug builds, `abort` then checks whether an abort signal handler is set. If a non-default signal handler is set, `abort` calls `raise(SIGABRT)`. Use the [signal](../../c-runtime-library/reference/signal.md) function to associate an abort signal handler function with the `SIGABRT` signal. You can perform custom actions—for example, clean up resources or log information—and terminate the app with your own error code in the handler function. If no custom signal handler is defined, `abort` does not raise the `SIGABRT` signal.
54-
55-
By default, in non-debug builds of desktop or console apps, `abort` then invokes the Windows error reporting mechanism (Dr. Watson) to report failures to Microsoft. This behavior can be enabled or disabled by calling `_set_abort_behavior` and setting or masking the `_CALL_REPORTFAULT` flag. When the flag is set, Windows displays a message box that has text something like "A problem caused the program to stop working correctly." The user can choose to invoke a debugger with a **Debug** button, or choose the **Close program** button to terminate the app with an error code that's defined by the operating system.
56-
57-
If the Windows error reporting handler is not invoked, then `abort` calls [_exit](../../c-runtime-library/reference/exit-exit-exit.md) to terminate the process with exit code 3 and returns control to the parent process or the operating system. `_exit` does not flush stream buffers or do `atexit`/`_onexit` processing.
58-
59-
For more information about CRT debugging, see [CRT Debugging Techniques](/visualstudio/debugger/crt-debugging-techniques).
60-
61-
**End Microsoft Specific**
62-
63-
## Requirements
64-
65-
|Routine|Required header|
66-
|-------------|---------------------|
67-
|`abort`|\<process.h> or \<stdlib.h>|
68-
69-
## Example
70-
The following program tries to open a file and aborts if the attempt fails.
71-
72-
```C
73-
// crt_abort.c
74-
// compile with: /TC
75-
// This program demonstrates the use of
76-
// the abort function by attempting to open a file
77-
// and aborts if the attempt fails.
78-
79-
#include <stdio.h>
80-
#include <stdlib.h>
81-
82-
int main( void )
83-
{
84-
FILE *stream = NULL;
85-
errno_t err = 0;
86-
87-
err = fopen_s(&stream, "NOSUCHF.ILE", "r" );
88-
if ((err != 0) || (stream == NULL))
89-
{
90-
perror( "File could not be opened" );
91-
abort();
92-
}
93-
else
94-
{
95-
fclose( stream );
96-
}
97-
}
98-
```
99-
100-
```Output
101-
File could not be opened: No such file or directory
102-
```
103-
104-
## See Also
105-
[Using abort](../../cpp/using-abort.md)
106-
[abort Function](../../c-language/abort-function-c.md)
107-
[Process and Environment Control](../../c-runtime-library/process-and-environment-control.md)
108-
[_exec, _wexec Functions](../../c-runtime-library/exec-wexec-functions.md)
109-
[exit, _Exit, _exit](../../c-runtime-library/reference/exit-exit-exit.md)
110-
[raise](../../c-runtime-library/reference/raise.md)
111-
[signal](../../c-runtime-library/reference/signal.md)
112-
[_spawn, _wspawn Functions](../../c-runtime-library/spawn-wspawn-functions.md)
113-
[_DEBUG](../../c-runtime-library/debug.md)
114-
[_set_abort_behavior](../../c-runtime-library/reference/set-abort-behavior.md)
26+
> Do not use this method to shut down a Microsoft Store app or [!INCLUDE[win8_appname_long](../../build/includes/win8_appname_long_md.md)] app, except in testing or debugging scenarios. Programmatic or UI ways to close a Store app are not permitted according to the [Microsoft Store policies](/legal/windows/agreements/store-policies). For more information, see [UWP app lifecycle](/windows/uwp/launch-resume/app-lifecycle).
27+
28+
## Syntax
29+
30+
```c
31+
void abort( void );
32+
```
33+
34+
## Return Value
35+
36+
`abort` does not return control to the calling process. By default, it checks for an abort signal handler and raises `SIGABRT` if one is set. Then `abort` terminates the current process and returns an exit code to the parent process.
37+
38+
## Remarks
39+
40+
**Microsoft Specific**
41+
42+
By default, when an app is built with the debug runtime library, the `abort` routine displays an error message before `SIGABRT` is raised. For console apps running in console mode, the message is sent to `STDERR`. Windows desktop apps and console apps running in windowed mode display the message in a message box. To suppress the message, use [_set_abort_behavior](../../c-runtime-library/reference/set-abort-behavior.md) to clear the `_WRITE_ABORT_MSG` flag. The message displayed depends on the version of the runtime environment used. For applications built by using the most recent versions of Visual C++, the message resembles this:
43+
44+
> R6010 - abort() has been called
45+
46+
In previous versions of the C runtime library, this message was displayed:
47+
48+
> This application has requested the Runtime to terminate it in an unusual way. Please contact the application's support team for more information.
49+
50+
When the program is compiled in debug mode, the message box displays options to **Abort**, **Retry**, or **Ignore**. If the user chooses **Abort**, the program terminates immediately and returns an exit code of 3. If the user chooses **Retry**, a debugger is invoked for just-in-time debugging, if available. If the user chooses **Ignore**, `abort` continues normal processing.
51+
52+
In both retail and debug builds, `abort` then checks whether an abort signal handler is set. If a non-default signal handler is set, `abort` calls `raise(SIGABRT)`. Use the [signal](../../c-runtime-library/reference/signal.md) function to associate an abort signal handler function with the `SIGABRT` signal. You can perform custom actions—for example, clean up resources or log information—and terminate the app with your own error code in the handler function. If no custom signal handler is defined, `abort` does not raise the `SIGABRT` signal.
53+
54+
By default, in non-debug builds of desktop or console apps, `abort` then invokes the Windows Error Reporting Service mechanism (formerly known as Dr. Watson) to report failures to Microsoft. This behavior can be enabled or disabled by calling `_set_abort_behavior` and setting or masking the `_CALL_REPORTFAULT` flag. When the flag is set, Windows displays a message box that has text something like "A problem caused the program to stop working correctly." The user can choose to invoke a debugger with a **Debug** button, or choose the **Close program** button to terminate the app with an error code that's defined by the operating system.
55+
56+
If the Windows error reporting handler is not invoked, then `abort` calls [_exit](../../c-runtime-library/reference/exit-exit-exit.md) to terminate the process with exit code 3 and returns control to the parent process or the operating system. `_exit` does not flush stream buffers or do `atexit`/`_onexit` processing.
57+
58+
For more information about CRT debugging, see [CRT Debugging Techniques](/visualstudio/debugger/crt-debugging-techniques).
59+
60+
**End Microsoft Specific**
61+
62+
## Requirements
63+
64+
|Routine|Required header|
65+
|-------------|---------------------|
66+
|`abort`|\<process.h> or \<stdlib.h>|
67+
68+
## Example
69+
70+
The following program tries to open a file and aborts if the attempt fails.
71+
72+
```C
73+
// crt_abort.c
74+
// compile with: /TC
75+
// This program demonstrates the use of
76+
// the abort function by attempting to open a file
77+
// and aborts if the attempt fails.
78+
79+
#include <stdio.h>
80+
#include <stdlib.h>
81+
82+
int main( void )
83+
{
84+
FILE *stream = NULL;
85+
errno_t err = 0;
86+
87+
err = fopen_s(&stream, "NOSUCHF.ILE", "r" );
88+
if ((err != 0) || (stream == NULL))
89+
{
90+
perror( "File could not be opened" );
91+
abort();
92+
}
93+
else
94+
{
95+
fclose( stream );
96+
}
97+
}
98+
```
99+
100+
```Output
101+
File could not be opened: No such file or directory
102+
```
103+
104+
## See also
105+
106+
[Using abort](../../cpp/using-abort.md)
107+
[abort Function](../../c-language/abort-function-c.md)
108+
[Process and Environment Control](../../c-runtime-library/process-and-environment-control.md)
109+
[_exec, _wexec Functions](../../c-runtime-library/exec-wexec-functions.md)
110+
[exit, _Exit, _exit](../../c-runtime-library/reference/exit-exit-exit.md)
111+
[raise](../../c-runtime-library/reference/raise.md)
112+
[signal](../../c-runtime-library/reference/signal.md)
113+
[_spawn, _wspawn Functions](../../c-runtime-library/spawn-wspawn-functions.md)
114+
[_DEBUG](../../c-runtime-library/debug.md)
115+
[_set_abort_behavior](../../c-runtime-library/reference/set-abort-behavior.md)

0 commit comments

Comments
 (0)