You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/c-runtime-library/format-specification-fields-scanf-and-wscanf-functions.md
+7-8Lines changed: 7 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,9 +5,8 @@ ms.date: "11/04/2016"
5
5
ms.topic: "reference"
6
6
ms.custom: contperf-fy21q1
7
7
helpviewer_keywords: ["width, specifications in scanf function", "scanf format specifications", "scanf width specifications", "scanf type field characters", "type fields, scanf function", "format specification fields for scanf function", "type fields"]
8
-
ms.assetid: 7e95de1b-0b71-4de3-9f81-c9560c78e039
9
8
---
10
-
# Format Specification Fields: scanf and wscanf Functions
9
+
# Format Specification Fields: `scanf` and `wscanf` Functions
11
10
12
11
The information here applies to the entire `scanf` family of functions, including the secure versions and describes the symbols used to tell the `scanf` functions how to parse the input stream, such as the input stream `stdin` for `scanf`, into values that are inserted into program variables.
13
12
@@ -17,7 +16,7 @@ A format specification has the following form:
17
16
18
17
The `format` argument specifies the interpretation of the input and can contain one or more of the following:
19
18
20
-
- White-space characters: blank (' '); tab ('\t'); or newline ('\n'). A white-space character causes `scanf` to read, but not store, all consecutive white-space characters in the input up to the next non-white-space character. One white-space character in the format matches any number (including 0) and combination of white-space characters in the input.
19
+
- White-space characters: blank (``); tab (`\t`); or newline (`\n`). A white-space character causes `scanf` to read, but not store, all consecutive white-space characters in the input up to the next non-white-space character. One white-space character in the format matches any number (including 0) and combination of white-space characters in the input.
21
20
22
21
- Non-white-space characters, except for the percent sign (`%`). A non-white-space character causes `scanf` to read, but not store, a matching non-white-space character. If the next character in the input stream does not match, `scanf` terminates.
23
22
@@ -35,11 +34,11 @@ The simplest format specification contains only the percent sign and a `type` ch
35
34
36
35
An asterisk (`*`) following the percent sign suppresses assignment of the next input field, which is interpreted as a field of the specified type. The field is scanned but not stored.
37
36
38
-
The secure versions (those with the `_s` suffix) of the `scanf` family of functions require that a buffer size parameter be passed immediately following each parameter of type `c`, `C`, `s`, `S` or `[`. For more information on the secure versions of the `scanf` family of functions, see [scanf_s, _scanf_s_l, wscanf_s, _wscanf_s_l](../c-runtime-library/reference/scanf-s-scanf-s-l-wscanf-s-wscanf-s-l.md).
37
+
The secure versions (those with the `_s` suffix) of the `scanf` family of functions require that a buffer size parameter be passed immediately following each parameter of type `c`, `C`, `s`, `S` or `[`. For more information on the secure versions of the `scanf` family of functions, see [`scanf_s`, `_scanf_s_l`, `wscanf_s`, `_wscanf_s_l`](../c-runtime-library/reference/scanf-s-scanf-s-l-wscanf-s-wscanf-s-l.md).
Dumps all the memory blocks in the debug heap when a memory leak has occurred (debug version only).
16
15
@@ -23,25 +22,25 @@ int _CrtDumpMemoryLeaks( void );
23
22
24
23
## Return Value
25
24
26
-
**_CrtDumpMemoryLeaks** returns TRUE if a memory leak is found. Otherwise, the function returns FALSE.
25
+
**`_CrtDumpMemoryLeaks`** returns `TRUE` if a memory leak is found. Otherwise, the function returns `FALSE`.
27
26
28
27
## Remarks
29
28
30
-
The **_CrtDumpMemoryLeaks** function determines whether a memory leak has occurred since the start of program execution. When a leak is found, the debug header information for all the objects in the heap is dumped in a user-readable form. When [_DEBUG](../../c-runtime-library/debug.md) is not defined, calls to **_CrtDumpMemoryLeaks** are removed during preprocessing.
29
+
The **`_CrtDumpMemoryLeaks`** function determines whether a memory leak has occurred since the start of program execution. When a leak is found, the debug header information for all the objects in the heap is dumped in a user-readable form. When [`_DEBUG`](../../c-runtime-library/debug.md) isn't defined, calls to **`_CrtDumpMemoryLeaks`** are removed during preprocessing.
31
30
32
-
**_CrtDumpMemoryLeaks** is frequently called at the end of program execution to verify that all memory allocated by the application has been freed. The function can be called automatically at program termination by turning on the **_CRTDBG_LEAK_CHECK_DF** bit field of the [_crtDbgFlag](../../c-runtime-library/crtdbgflag.md) flag using the [_CrtSetDbgFlag](crtsetdbgflag.md) function.
31
+
**`_CrtDumpMemoryLeaks`** is frequently called at the end of program execution to verify that all memory allocated by the application has been freed. The function can be called automatically at program termination by turning on the **`_CRTDBG_LEAK_CHECK_DF`** bit field of the [`_crtDbgFlag`](../../c-runtime-library/crtdbgflag.md) flag using the [`_CrtSetDbgFlag`](crtsetdbgflag.md) function.
33
32
34
-
**_CrtDumpMemoryLeaks** calls [_CrtMemCheckpoint](crtmemcheckpoint.md) to obtain the current state of the heap and then scans the state for blocks that have not been freed. When an unfreed block is encountered, **_CrtDumpMemoryLeaks** calls [_CrtMemDumpAllObjectsSince](crtmemdumpallobjectssince.md) to dump information for all the objects allocated in the heap from the start of program execution.
33
+
**`_CrtDumpMemoryLeaks`** calls [`_CrtMemCheckpoint`](crtmemcheckpoint.md) to obtain the current state of the heap and then scans the state for blocks that haven't been freed. When an unfreed block is encountered, **`_CrtDumpMemoryLeaks`** calls [`_CrtMemDumpAllObjectsSince`](crtmemdumpallobjectssince.md) to dump information for all the objects allocated in the heap from the start of program execution.
35
34
36
-
By default, internal C run-time blocks (**_CRT_BLOCK**) are not included in memory dump operations. The [_CrtSetDbgFlag](crtsetdbgflag.md) function can be used to turn on the **_CRTDBG_CHECK_CRT_DF** bit of **_crtDbgFlag** to include these blocks in the leak detection process.
35
+
By default, internal C run-time blocks (**`_CRT_BLOCK`**) aren't included in memory dump operations. The [`_CrtSetDbgFlag`](crtsetdbgflag.md) function can be used to turn on the **`_CRTDBG_CHECK_CRT_DF`** bit of **`_crtDbgFlag`** to include these blocks in the leak detection process.
37
36
38
-
For more information about heap state functions and the **_CrtMemState** structure, see [Heap State Reporting Functions](/visualstudio/debugger/crt-debug-heap-details). For more 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).
37
+
For more information about heap state functions and the **`_CrtMemState`** structure, see [Heap State Reporting Functions](/visualstudio/debugger/crt-debug-heap-details). For more 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).
39
38
40
39
## Requirements
41
40
42
41
|Routine|Required header|
43
42
|-------------|---------------------|
44
-
|**_CrtDumpMemoryLeaks**|\<crtdbg.h>|
43
+
|**`_CrtDumpMemoryLeaks`**|`<crtdbg.h>`|
45
44
46
45
For more compatibility information, see [Compatibility](../../c-runtime-library/compatibility.md).
47
46
@@ -51,8 +50,8 @@ Debug versions of [C run-time libraries](../../c-runtime-library/crt-library-fea
51
50
52
51
## Example
53
52
54
-
For a sample of how to use **_CrtDumpMemoryLeaks**, see [crt_dbg1](https://github.com/Microsoft/VCSamples/tree/master/VC2010Samples/crt/crt_dbg1).
53
+
For a sample of how to use **`_CrtDumpMemoryLeaks`**, see [`crt_dbg1`](https://github.com/Microsoft/VCSamples/tree/master/VC2010Samples/crt/crt_dbg1).
0 commit comments