Skip to content

Commit 931c68f

Browse files
authored
Merge pull request #4347 from MicrosoftDocs/main638073307506063925sync_temp
Repo sync for protected CLA branch
2 parents d843cbf + a6add0f commit 931c68f

File tree

3 files changed

+11
-12
lines changed

3 files changed

+11
-12
lines changed

docs/c-runtime-library/format-specification-syntax-printf-and-wprintf-functions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ A basic conversion specification contains only the percent sign and a *type* cha
3333

3434
The *type* conversion specifier character specifies whether to interpret the corresponding argument as a character, a string, a pointer, an integer, or a floating-point number. The *type* character is the only required conversion specification field, and it appears after any optional fields.
3535

36-
The arguments that follow the format string are interpreted according to the corresponding *type* character and the optional [*size*](#size) prefix. Conversions for character types `char` and `wchar_t` are specified by using **`c`** or **`C`**, and single-byte and multi-byte or wide character strings are specified by using **`s`** or **`S`**, depending on which formatting function is being used. Character and string arguments that are specified by using **`c`** and **`s`** are interpreted as `char` and `char*` by `printf` family functions, or as `wchar_t` and `wchar_t*` by `wprintf` family functions. Character and string arguments that are specified by using **`C`** and **`S`** are interpreted as `wchar_t` and `wchar_t*` by `printf` family functions, or as `char` and `char*` by `wprintf` family functions. This behavior is Microsoft-specific.
36+
The arguments that follow the format string are interpreted according to the corresponding *type* character and the optional [*size*](#size) prefix. Conversions for character types `char` and `wchar_t` are specified by using **`c`** or **`C`**, and single-byte and multi-byte or wide character strings are specified by using **`s`** or **`S`**, depending on which formatting function is being used. Character and string arguments that are specified by using **`c`** and **`s`** are interpreted as `char` and `char*` by `printf` family functions, or as `wchar_t` and `wchar_t*` by `wprintf` family functions. Character and string arguments that are specified by using **`C`** and **`S`** are interpreted as `wchar_t` and `wchar_t*` by `printf` family functions, or as `char` and `char*` by `wprintf` family functions. This behavior is Microsoft-specific. For historical reasons, the `wprintf` functions use **`c`** and **`s`** to refer to `wchar_t` characters, and **`C`** and **`S`** specify narrow characters.
3737

3838
Integer types such as `short`, `int`, `long`, `long long`, and their `unsigned` variants, are specified by using **`d`**, **`i`**, **`o`**, **`u`**, **`x`**, and **`X`**. Floating-point types such as `float`, `double`, and `long double`, are specified by using **`a`**, **`A`**, **`e`**, **`E`**, **`f`**, **`F`**, **`g`**, and **`G`**. By default, unless they're modified by a *size* prefix, integer arguments are coerced to `int` type, and floating-point arguments are coerced to `double`. On 64-bit systems, an `int` is a 32-bit value; so, 64-bit integers will be truncated when they're formatted for output unless a *size* prefix of **`ll`** or **`I64`** is used. Pointer types that are specified by **`p`** use the default pointer size for the platform.
3939

docs/c-runtime-library/reference/asctime-wasctime.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
description: "Learn more about: asctime, _wasctime"
33
title: "asctime, _wasctime"
4-
ms.date: "4/2/2020"
4+
ms.date: 12/21/2022
55
api_name: ["_wasctime", "asctime", "_o__wasctime", "_o_asctime"]
66
api_location: ["msvcrt.dll", "msvcr80.dll", "msvcr90.dll", "msvcr100.dll", "msvcr100_clr0400.dll", "msvcr110.dll", "msvcr110_clr0400.dll", "msvcr120.dll", "msvcr120_clr0400.dll", "ucrtbase.dll", "api-ms-win-crt-time-l1-1-0.dll"]
77
api_type: ["DLLExport"]
@@ -52,32 +52,32 @@ The **`asctime`** function converts a time stored as a structure to a character
5252
| `tm_yday` | Day of year (0-365; January 1 = 0) |
5353
| `tm_year` | Year (current year minus 1900) |
5454

55-
The converted character string is also adjusted according to the local time zone settings. For information about configuring the local time, see the [`time`](time-time32-time64.md), [`_ftime`](ftime-ftime32-ftime64.md), and [`localtime`](localtime-localtime32-localtime64.md) functions. For information about defining the time zone environment and global variables, see the [`_tzset`](tzset.md) function.
55+
For information about configuring the local time, see the [`time`](time-time32-time64.md), [`_ftime`](ftime-ftime32-ftime64.md), and [`localtime`](localtime-localtime32-localtime64.md) functions. For information about defining the time zone environment and global variables, see the [`_tzset`](tzset.md) function.
5656

5757
The string result produced by **`asctime`** contains exactly 26 characters and has the form `Wed Jan 2 02:03:55 1980\n\0`. A 24-hour clock is used. All fields have a constant width. The newline character and the null character occupy the last two positions of the string. **`asctime`** uses a single, statically allocated buffer to hold the return string. Each call to this function destroys the result of the previous call.
5858

59-
**`_wasctime`** is a wide-character version of **`asctime`**. **`_wasctime`** and **`asctime`** behave identically otherwise.
59+
**`_wasctime`** is a wide-character version of **`asctime`**, and otherwise behaves identically to **`asctime`**.
6060

6161
These functions validate their parameters. If *`timeptr`* is a null pointer, or if it contains out-of-range values, the invalid parameter handler is invoked, as described in [Parameter validation](../parameter-validation.md). If execution is allowed to continue, the function returns `NULL` and sets `errno` to `EINVAL`.
6262

6363
By default, this function's global state is scoped to the application. To change this behavior, see [Global state in the CRT](../global-state.md).
6464

6565
### Generic-text routine mapping
6666

67-
| TCHAR.H routine | `_UNICODE` and `_MBCS` not defined | `_MBCS` defined | `_UNICODE` defined |
67+
| `TCHAR.H` routine | `_UNICODE` and `_MBCS` not defined | `_MBCS` defined | `_UNICODE` defined |
6868
|---|---|---|---|
6969
| `_tasctime` | **`asctime`** | **`asctime`** | **`_wasctime`** |
7070

7171
## Requirements
7272

7373
| Routine | Required header |
7474
|---|---|
75-
| **`asctime`** | \<time.h> |
76-
| **`_wasctime`** | \<time.h> or \<wchar.h> |
75+
| **`asctime`** | `<time.h>` |
76+
| **`_wasctime`** | `<time.h>` or `<wchar.h>` |
7777

7878
## Example
7979

80-
This program places the system time in the long integer `aclock`, translates it into the structure `newtime` and then converts it to string form for output, using the **`asctime`** function.
80+
This program places the system time in the long integer `aclock`, translates it into the structure `newtime`, and then converts it to string form for output using the **`asctime`** function.
8181

8282
```C
8383
// crt_asctime.c

docs/c-runtime-library/reference/fopen-wfopen.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ api_type: ["DLLExport"]
88
topic_type: ["apiref"]
99
f1_keywords: ["STDIO/fopen", "CORECRT_WSTDIO/_wfopen", "TCHAR/_tfopen", "fopen", "_wfopen", "_tfopen"]
1010
helpviewer_keywords: ["opening files, for file I/O", "wfopen function", "tfopen function", "_tfopen function", "_wfopen function", "files [C++], opening", "fopen function"]
11-
ms.assetid: e868993f-738c-4920-b5e4-d8f2f41f933d
1211
---
1312
# `fopen`, `_wfopen`
1413

@@ -70,7 +69,7 @@ The following table summarizes the modes that are used for various **`ccs`** fla
7069

7170
### Encodings used based on ccs flag and BOM
7271

73-
| ccs flag | No BOM (or new file) | BOM: UTF-8 | BOM: UTF-16 |
72+
| `ccs` flag | No BOM (or new file) | BOM: UTF-8 | BOM: UTF-16 |
7473
|--|--|--|--|
7574
| `UNICODE` | **`UTF-16LE`** | **`UTF-8`** | **`UTF-16LE`** |
7675
| **`UTF-8`** | **`UTF-8`** | **`UTF-8`** | **`UTF-16LE`** |
@@ -82,7 +81,7 @@ If *`mode`* is **`a, ccs=encoding`** for some `encoding` value, **`fopen`** firs
8281

8382
### Generic-text routine mappings
8483

85-
| TCHAR.H routine | `_UNICODE` and `_MBCS` not defined | `_MBCS` defined | `_UNICODE` defined |
84+
| `TCHAR.H` routine | `_UNICODE` and `_MBCS` not defined | `_MBCS` defined | `_UNICODE` defined |
8685
|--|--|--|--|
8786
| **`_tfopen`** | **`fopen`** | **`fopen`** | **`_wfopen`** |
8887

@@ -130,7 +129,7 @@ The following options can be appended to *`mode`* to specify more behaviors.
130129
| **`R`** | Specifies that caching is optimized for, but not restricted to, random access from disk. |
131130
| **`T`** | Specifies a file as temporary. If possible, it isn't flushed to disk. |
132131
| **`D`** | Specifies a file as temporary. It's deleted when the last file pointer is closed. |
133-
| **`ccs=encoding`** | Specifies the encoded character set to use (one of **`UTF-8`**, **`UTF-16LE`**, or `UNICODE`) for this file. Leave unspecified if you want ANSI encoding. |
132+
| **`ccs=encoding`** | Specifies the encoded character set to use (one of **`UTF-8`**, **`UTF-16LE`**, or `UNICODE`) for this file. Leave unspecified if you want ANSI encoding. This flag is separated from flags that precede it by a comma (`,`). For example: `FILE *f = fopen("newfile.txt", "rt+, ccs=UTF-8");` |
134133

135134
Valid characters for the *`mode`* string that is used in **`fopen`** and **`_fdopen`** correspond to *`oflag`* arguments that are used in [`_open`](open-wopen.md) and [`_sopen`](sopen-wsopen.md), as follows.
136135

0 commit comments

Comments
 (0)