Skip to content

Commit af9c88b

Browse files
authored
Merge pull request #4161 from craigcaseyMSFT/vcraigcasey0304
US1907300 - add md code escapes to code elements - PR22
2 parents 8760f27 + d988094 commit af9c88b

12 files changed

Lines changed: 765 additions & 776 deletions

‎docs/c-runtime-library/exit-success-exit-failure.md‎

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,8 @@ title: "EXIT_SUCCESS, EXIT_FAILURE"
44
ms.date: "06/25/2018"
55
f1_keywords: ["EXIT_FAILURE", "EXIT_SUCCESS"]
66
helpviewer_keywords: ["EXIT_SUCCESS constant", "EXIT_FAILURE constant"]
7-
ms.assetid: ff2c82cb-c0bb-4556-a812-59aa278bfac5
87
---
9-
# EXIT_SUCCESS, EXIT_FAILURE
8+
# `EXIT_SUCCESS`, `EXIT_FAILURE`
109

1110
## Required header
1211

@@ -16,12 +15,12 @@ ms.assetid: ff2c82cb-c0bb-4556-a812-59aa278bfac5
1615

1716
## Remarks
1817

19-
These are arguments for the [exit](reference/exit-exit-exit.md) and [_exit](reference/exit-exit-exit.md) functions, and the return values for the [atexit](reference/atexit.md) and [_onexit](reference/onexit-onexit-m.md) functions.
18+
These are arguments for the [`exit`](reference/exit-exit-exit.md) and [`_exit`](reference/exit-exit-exit.md) functions, and the return values for the [`atexit`](reference/atexit.md) and [`_onexit`](reference/onexit-onexit-m.md) functions.
2019

2120
|Constant|Defined value|
2221
|-|-|
23-
|EXIT_SUCCESS|0|
24-
|EXIT_FAILURE|1|
22+
|`EXIT_SUCCESS`|0|
23+
|`EXIT_FAILURE`|1|
2524

2625
## See also
2726

‎docs/c-runtime-library/reference/crtisvalidheappointer.md‎

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,8 @@ api_type: ["DLLExport"]
88
topic_type: ["apiref"]
99
f1_keywords: ["CrtlsValidHeapPointer", "_CrtIsValidHeapPointer"]
1010
helpviewer_keywords: ["_CrtIsValidHeapPointer function", "CrtIsValidHeapPointer function"]
11-
ms.assetid: caf597ce-1b05-4764-9f37-0197a982bec5
1211
---
13-
# _CrtIsValidHeapPointer
12+
# `_CrtIsValidHeapPointer`
1413

1514
Verifies that a specified pointer is in a heap allocated by some C run-time library, but not necessarily by the caller's CRT library. In versions of the CRT before Visual Studio 2010, this verifies that the specified pointer is in the local heap (debug version only).
1615

@@ -24,30 +23,30 @@ int _CrtIsValidHeapPointer(
2423

2524
### Parameters
2625

27-
*userData*<br/>
26+
*`userData`*\
2827
Pointer to the beginning of an allocated memory block.
2928

3029
## Return Value
3130

32-
**_CrtIsValidHeapPointer** returns TRUE if the specified pointer is in the heap shared by all CRT library instances. In versions of the CRT before Visual Studio 2010, this returns TRUE if the specified pointer is in the local heap. Otherwise, the function returns FALSE.
31+
**`_CrtIsValidHeapPointer`** returns `TRUE` if the specified pointer is in the heap shared by all CRT library instances. In versions of the CRT before Visual Studio 2010, this returns `TRUE` if the specified pointer is in the local heap. Otherwise, the function returns `FALSE`.
3332

3433
## Remarks
3534

36-
We do not recommend that you use this function. Starting with the Visual Studio 2010 CRT library, all CRT libraries share one OS heap, the *process heap*. The **_CrtIsValidHeapPointer** function reports whether the pointer was allocated in a CRT heap, but not that it was allocated by the caller's CRT library. For example, consider a block allocated by using the Visual Studio 2010 version of the CRT library. If the **_CrtIsValidHeapPointer** function exported by the Visual Studio 2012 version of the CRT library tests the pointer, it returns TRUE. This is no longer a useful test. In versions of the CRT library before Visual Studio 2010, the function is used to ensure that a specific memory address is within the local heap. The local heap refers to the heap created and managed by a particular instance of the C run-time library. If a dynamic-link library (DLL) contains a static link to the run-time library, it has its own instance of the run-time heap, and therefore its own heap, independent of the application's local heap. When [_DEBUG](../../c-runtime-library/debug.md) is not defined, calls to **_CrtIsValidHeapPointer** are removed during preprocessing.
35+
We don't recommend that you use this function. Starting with the Visual Studio 2010 CRT library, all CRT libraries share one OS heap, the *process heap*. The **`_CrtIsValidHeapPointer`** function reports whether the pointer was allocated in a CRT heap, but not that it was allocated by the caller's CRT library. For example, consider a block allocated by using the Visual Studio 2010 version of the CRT library. If the **`_CrtIsValidHeapPointer`** function exported by the Visual Studio 2012 version of the CRT library tests the pointer, it returns `TRUE`. This is no longer a useful test. In versions of the CRT library before Visual Studio 2010, the function is used to ensure that a specific memory address is within the local heap. The local heap refers to the heap created and managed by a particular instance of the C run-time library. If a dynamic-link library (DLL) contains a static link to the run-time library, it has its own instance of the run-time heap, and therefore its own heap, independent of the application's local heap. When [`_DEBUG`](../../c-runtime-library/debug.md) isn't defined, calls to **`_CrtIsValidHeapPointer`** are removed during preprocessing.
3736

38-
Because this function returns TRUE or FALSE, it can be passed to one of the [_ASSERT](assert-asserte-assert-expr-macros.md) macros to create a simple debugging error handling mechanism. The following example causes an assertion failure if the specified address is not located within the local heap:
37+
Because this function returns `TRUE` or `FALSE`, it can be passed to one of the [`_ASSERT`](assert-asserte-assert-expr-macros.md) macros to create a simple debugging error handling mechanism. The following example causes an assertion failure if the specified address isn't located within the local heap:
3938

4039
```C
4140
_ASSERTE( _CrtIsValidHeapPointer( userData ) );
4241
```
4342
44-
For more information about how **_CrtIsValidHeapPointer** can be used with other debug functions and macros, see [Macros for Reporting](/visualstudio/debugger/macros-for-reporting). For information about how memory blocks are allocated, initialized, and managed in the debug version of the base heap, see [CRT Debug Heap Details](/visualstudio/debugger/crt-debug-heap-details).
43+
For more information about how **`_CrtIsValidHeapPointer`** can be used with other debug functions and macros, see [Macros for Reporting](/visualstudio/debugger/macros-for-reporting). For information about how memory blocks are allocated, initialized, and managed in the debug version of the base heap, see [CRT Debug Heap Details](/visualstudio/debugger/crt-debug-heap-details).
4544
4645
## Requirements
4746
4847
|Routine|Required header|
4948
|-------------|---------------------|
50-
|**_CrtIsValidHeapPointer**|\<crtdbg.h>|
49+
|**`_CrtIsValidHeapPointer`**|`<crtdbg.h>`|
5150
5251
For more compatibility information, see [Compatibility](../../c-runtime-library/compatibility.md).
5352
@@ -57,7 +56,7 @@ Debug versions of [C run-time libraries](../../c-runtime-library/crt-library-fea
5756
5857
## Example
5958
60-
The following example demonstrates how to test whether memory is valid when it is used with C run-time libraries before Visual Studio 2010. This example is provided for users of legacy CRT library code.
59+
The following example demonstrates how to test whether memory is valid when it's used with C run-time libraries before Visual Studio 2010. This example is provided for users of legacy CRT library code.
6160
6261
```C
6362
// crt_isvalid.c
@@ -111,4 +110,4 @@ my_pointer is within the local heap.
111110

112111
## See also
113112

114-
[Debug Routines](../../c-runtime-library/debug-routines.md)<br/>
113+
[Debug Routines](../../c-runtime-library/debug-routines.md)

‎docs/c-runtime-library/reference/dup-dup2.md‎

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,10 @@ api_type: ["DLLExport"]
88
topic_type: ["apiref"]
99
f1_keywords: ["_dup2", "_dup"]
1010
helpviewer_keywords: ["_dup2 function", "dup function", "file handles [C++], duplicating", "file handles [C++], reassigning", "dup2 function", "_dup function"]
11-
ms.assetid: 4d07e92c-0d76-4832-a770-dfec0e7a0cfa
1211
---
13-
# _dup, _dup2
12+
# `_dup`, `_dup2`
1413

15-
Creates a second file descriptor for an open file (**_dup**), or reassigns a file descriptor (**_dup2**).
14+
Creates a second file descriptor for an open file (**`_dup`**), or reassigns a file descriptor (**`_dup2`**).
1615

1716
## Syntax
1817

@@ -23,23 +22,23 @@ int _dup2( int fd1, int fd2 );
2322
2423
### Parameters
2524
26-
*fd*, *fd1*<br/>
25+
*`fd`*, *`fd1`*\
2726
File descriptors referring to open file.
2827
29-
*fd2*<br/>
28+
*`fd2`*\
3029
Any file descriptor.
3130
3231
## Return Value
3332
34-
**_dup** returns a new file descriptor. **_dup2** returns 0 to indicate success. If an error occurs, each function returns -1 and sets **errno** to **EBADF** if the file descriptor is invalid or to **EMFILE** if no more file descriptors are available. In the case of an invalid file descriptor, the function also invokes the invalid parameter handler, as described in [Parameter Validation](../../c-runtime-library/parameter-validation.md).
33+
**`_dup`** returns a new file descriptor. **`_dup2`** returns 0 to indicate success. If an error occurs, each function returns -1 and sets **`errno`** to **`EBADF`** if the file descriptor is invalid or to **`EMFILE`** if no more file descriptors are available. In the case of an invalid file descriptor, the function also invokes the invalid parameter handler, as described in [Parameter Validation](../../c-runtime-library/parameter-validation.md).
3534
36-
For more information about these and other return codes, see [_doserrno, errno, _sys_errlist, and _sys_nerr](../../c-runtime-library/errno-doserrno-sys-errlist-and-sys-nerr.md).
35+
For more information about these and other return codes, see [`_doserrno`, `errno`, `_sys_errlist`, and `_sys_nerr`](../../c-runtime-library/errno-doserrno-sys-errlist-and-sys-nerr.md).
3736
3837
## Remarks
3938
40-
The **_dup** and **_dup2** functions associate a second file descriptor with a currently open file. These functions can be used to associate a predefined file descriptor, such as that for **stdout**, with a different file. Operations on the file can be carried out using either file descriptor. The type of access allowed for the file is unaffected by the creation of a new descriptor. **_dup** returns the next available file descriptor for the given file. **_dup2** forces *fd2* to refer to the same file as *fd1*. If *fd2* is associated with an open file at the time of the call, that file is closed.
39+
The **`_dup`** and **`_dup2`** functions associate a second file descriptor with a currently open file. These functions can be used to associate a predefined file descriptor, such as that for **`stdout`**, with a different file. Operations on the file can be carried out using either file descriptor. The type of access allowed for the file is unaffected by the creation of a new descriptor. **`_dup`** returns the next available file descriptor for the given file. **`_dup2`** forces *`fd2`* to refer to the same file as *`fd1`*. If *`fd2`* is associated with an open file at the time of the call, that file is closed.
4140
42-
Both **_dup** and **_dup2** accept file descriptors as parameters. To pass a stream (`FILE *`) to either of these functions, use [_fileno](fileno.md). The **fileno** routine returns the file descriptor currently associated with the given stream. The following example shows how to associate **stderr** (defined as `FILE *` in Stdio.h) with a file descriptor:
41+
Both **`_dup`** and **`_dup2`** accept file descriptors as parameters. To pass a stream (`FILE *`) to either of these functions, use [`_fileno`](fileno.md). The **`fileno`** routine returns the file descriptor currently associated with the given stream. The following example shows how to associate **`stderr`** (defined as `FILE *` in `stdio.h`) with a file descriptor:
4342
4443
```C
4544
int cstderr = _dup( _fileno( stderr ));
@@ -51,10 +50,10 @@ By default, this function's global state is scoped to the application. To change
5150

5251
|Routine|Required header|
5352
|-------------|---------------------|
54-
|**_dup**|\<io.h>|
55-
|**_dup2**|\<io.h>|
53+
|**`_dup`**|`<io.h>`|
54+
|**`_dup2`**|`<io.h>`|
5655

57-
The console is not supported in Universal Windows Platform (UWP) apps. The standard stream handles that are associated with the console, **stdin**, **stdout**, and **stderr**, must be redirected before C run-time functions can use them in UWP apps. For more compatibility information, see [Compatibility](../../c-runtime-library/compatibility.md).
56+
The console isn't supported in Universal Windows Platform (UWP) apps. The standard stream handles that are associated with the console, **`stdin`**, **`stdout`**, and **`stderr`**, must be redirected before C run-time functions can use them in UWP apps. For more compatibility information, see [Compatibility](../../c-runtime-library/compatibility.md).
5857

5958
## Example
6059

@@ -119,7 +118,7 @@ This goes to file 'data'
119118

120119
## See also
121120

122-
[Low-Level I/O](../../c-runtime-library/low-level-i-o.md)<br/>
123-
[_close](close.md)<br/>
124-
[_creat, _wcreat](creat-wcreat.md)<br/>
125-
[_open, _wopen](open-wopen.md)<br/>
121+
[Low-Level I/O](../../c-runtime-library/low-level-i-o.md)\
122+
[`_close`](close.md)\
123+
[`_creat`, `_wcreat`](creat-wcreat.md)\
124+
[`_open`, `_wopen`](open-wopen.md)

‎docs/c-runtime-library/reference/freopen-wfreopen.md‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ By default, this function's global state is scoped to the application. To change
6363

6464
|*`mode`*|Access|
6565
|-|-|
66-
| **`"r"`** | Opens for reading. If the file doesn't exist or cannot be found, the **`freopen`** call fails. |
66+
| **`"r"`** | Opens for reading. If the file doesn't exist or can’t be found, the **`freopen`** call fails. |
6767
| **`"w"`** | Opens an empty file for writing. If the given file exists, its contents are destroyed. |
6868
| **`"a"`** | Opens for writing at the end of the file (appending) without removing the end-of-file (EOF) marker before new data is written to the file. Creates the file if it doesn't exist. |
6969
| **`"r+"`** | Opens for both reading and writing. The file must exist. |
@@ -72,7 +72,7 @@ By default, this function's global state is scoped to the application. To change
7272

7373
Use the **`"w"`** and **`"w+"`** types with care, as they can destroy existing files. Starting in C11, you can append **`"x"`** to **`"w"`** or **`"w+"`** to cause the function fail if the file exists, instead of overwriting it.
7474

75-
When a file is opened with the **`"a"`** or **`"a+"`** access type, all write operations take place at the end of the file. Although the file pointer can be repositioned using [`fseek`](fseek-fseeki64.md) or [`rewind`](rewind.md), the file pointer is always moved back to the end of the file before any write operation is carried out. Thus, existing data cannot be overwritten.
75+
When a file is opened with the **`"a"`** or **`"a+"`** access type, all write operations take place at the end of the file. Although the file pointer can be repositioned using [`fseek`](fseek-fseeki64.md) or [`rewind`](rewind.md), the file pointer is always moved back to the end of the file before any write operation is carried out. Thus, existing data can’t be overwritten.
7676

7777
The **`"a"`** mode doesn't remove the EOF marker before appending to the file. After appending has occurred, the MS-DOS TYPE command only shows data up to the original EOF marker and not any data appended to the file. The **`"a+"`** mode does remove the EOF marker before appending to the file. After appending, the MS-DOS TYPE command shows all data in the file. The **`"a+"`** mode is required for appending to a stream file that is terminated with the CTRL+Z EOF marker.
7878

@@ -83,7 +83,7 @@ When the **`"r+"`**, **`"w+"`**, or **`"a+"`** access type is specified, both re
8383
| **`t`** | Open in text (translated) mode. |
8484
| **`b`** | Open in binary (untranslated) mode; translations involving carriage-return and line feed characters are suppressed. |
8585

86-
In text (translated) mode, carriage return-line feed (CR-LF) combinations are translated into single line feed (LF) characters on input; LF characters are translated to CR-LF combinations on output. Also, CTRL+Z is interpreted as an end-of-file character on input. In files opened for reading or for writing and reading with **`"a+"`**, the run-time library checks for a CTRL+Z at the end of the file and removes it, if possible. This is done because using [`fseek`](fseek-fseeki64.md) and [ftell](ftell-ftelli64.md) to move within a file may cause [`fseek`](fseek-fseeki64.md) to behave improperly near the end of the file. Don't use the **`t`** option if you want ANSI portability because it's a Microsoft extension.
86+
In text (translated) mode, carriage return-line feed (CR-LF) combinations are translated into single line feed (LF) characters on input; LF characters are translated to CR-LF combinations on output. Also, CTRL+Z is interpreted as an end-of-file character on input. In files opened for reading or for writing and reading with **`"a+"`**, the run-time library checks for a CTRL+Z at the end of the file and removes it, if possible. This is done because using [`fseek`](fseek-fseeki64.md) and [`ftell`](ftell-ftelli64.md) to move within a file may cause [`fseek`](fseek-fseeki64.md) to behave improperly near the end of the file. Don't use the **`t`** option if you want ANSI portability because it's a Microsoft extension.
8787

8888
If **`t`** or **`b`** isn't given in *`mode`*, the default translation mode is defined by the global variable [`_fmode`](../../c-runtime-library/fmode.md). If **`t`** or **`b`** is prefixed to the argument, the function fails and returns **`NULL`**.
8989

‎docs/c-runtime-library/reference/getcwd.md‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,12 @@ api_type: ["DLLExport"]
88
topic_type: ["apiref"]
99
f1_keywords: ["getcwd"]
1010
helpviewer_keywords: ["getcwd function"]
11-
ms.assetid: c740ab06-9ba0-4036-a025-ce3acded3ffe
1211
---
13-
# getcwd
12+
# `getcwd`
1413

15-
The Microsoft-implemented POSIX function name `getcwd` is a deprecated alias for the [_getcwd](getcwd-wgetcwd.md) function. By default, it generates [Compiler warning (level 3) C4996](../../error-messages/compiler-warnings/compiler-warning-level-3-c4996.md). The name is deprecated because it doesn't follow the Standard C rules for implementation-specific names. However, the function is still supported.
14+
The Microsoft-implemented POSIX function name `getcwd` is a deprecated alias for the [`_getcwd`](getcwd-wgetcwd.md) function. By default, it generates [Compiler warning (level 3) C4996](../../error-messages/compiler-warnings/compiler-warning-level-3-c4996.md). The name is deprecated because it doesn't follow the Standard C rules for implementation-specific names. However, the function is still supported.
1615

17-
We recommend you use [_getcwd](getcwd-wgetcwd.md) instead. Or, you can continue to use this function name, and disable the warning. For more information, see [Turn off the warning](../../error-messages/compiler-warnings/compiler-warning-level-3-c4996.md#turn-off-the-warning) and [POSIX function names](../../error-messages/compiler-warnings/compiler-warning-level-3-c4996.md#posix-function-names).
16+
We recommend you use [`_getcwd`](getcwd-wgetcwd.md) instead. Or, you can continue to use this function name, and disable the warning. For more information, see [Turn off the warning](../../error-messages/compiler-warnings/compiler-warning-level-3-c4996.md#turn-off-the-warning) and [POSIX function names](../../error-messages/compiler-warnings/compiler-warning-level-3-c4996.md#posix-function-names).
1817

1918
> [!IMPORTANT]
2019
> This API cannot be used in applications that execute in the Windows Runtime. For more information, see [CRT functions not supported in Universal Windows Platform apps](../../cppcx/crt-functions-not-supported-in-universal-windows-platform-apps.md).

0 commit comments

Comments
 (0)