Skip to content

Commit e93f3e6

Browse files
authored
Merge pull request #2626 from MicrosoftDocs/master
1/16/2020 AM Publish
2 parents 49e4fb3 + db06e60 commit e93f3e6

9 files changed

Lines changed: 73 additions & 62 deletions

docs/c-language/main-function-and-program-execution.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,5 @@ See [Using wmain](../c-language/using-wmain.md) for a description of the wide-ch
2626

2727
## See also
2828

29-
[main: Program Startup](../cpp/main-program-startup.md)<br/>
29+
[main function and command-line arguments (C++)](../cpp/main-function-command-line-args.md)\
3030
[Parsing C Command-Line Arguments](../c-language/parsing-c-command-line-arguments.md)

docs/c-runtime-library/argc-argv-wargv.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
---
22
title: "__argc, __argv, __wargv"
3+
description: "Describes the Microsoft C runtime library global constants __argc, __argv, and __wargv."
34
ms.date: "11/04/2016"
45
api_name: ["__wargv", "__argv", "__argc"]
56
api_location: ["msvcrt120.dll"]
@@ -8,14 +9,15 @@ topic_type: ["apiref"]
89
f1_keywords: ["__argv", "__argc", "__wargv"]
910
helpviewer_keywords: ["__argv", "__wargv", "__argc"]
1011
ms.assetid: 17001b0a-04ad-4762-b3a6-c54847f02d7c
12+
no-loc: [__argc, __argv, __wargv, main, wmain]
1113
---
1214
# __argc, __argv, __wargv
1315

1416
The `__argc` global variable is a count of the number of command-line arguments passed to the program. `__argv` is a pointer to an array of single-byte-character or multi-byte-character strings that contain the program arguments, and `__wargv` is a pointer to an array of wide-character strings that contain the program arguments. These global variables provide the arguments to `main` or `wmain`.
1517

1618
## Syntax
1719

18-
```
20+
```C
1921
extern int __argc;
2022
extern char ** __argv;
2123
extern wchar_t ** __wargv;
@@ -27,7 +29,7 @@ In a program that uses the `main` function, `__argc` and `__argv` are initializ
2729

2830
For portable code, we recommend you use the arguments passed to `main` to get the command-line arguments in your program.
2931

30-
### Generic-Text Routine Mappings
32+
### Generic-text routine mappings
3133

3234
|Tchar.h routine|_UNICODE not defined|_UNICODE defined|
3335
|---------------------|---------------------------|-----------------------|
@@ -43,6 +45,6 @@ For portable code, we recommend you use the arguments passed to `main` to get th
4345

4446
## See also
4547

46-
[Global Variables](../c-runtime-library/global-variables.md)<br/>
47-
[main: Program Startup](../cpp/main-program-startup.md)<br/>
48+
[Global variables](../c-runtime-library/global-variables.md)\
49+
[main function and command-line arguments (C++)](../cpp/main-function-command-line-args.md)\
4850
[Using wmain Instead of main](../cpp/using-wmain-instead-of-main.md)

docs/c-runtime-library/reference/getenv-s-wgetenv-s.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
---
22
title: "getenv_s, _wgetenv_s"
3-
ms.date: "11/04/2016"
3+
description: "Describes the Microsoft C runtime library getenv_s and _wgetenv_s functions."
4+
ms.date: "01/15/2020"
45
api_name: ["getenv_s", "_wgetenv_s"]
56
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-environment-l1-1-0.dll"]
67
api_type: ["DLLExport"]
78
topic_type: ["apiref"]
89
f1_keywords: ["getenv_s", "_tgetenv_s", "_wgetenv_s"]
910
helpviewer_keywords: ["_tgetenv_s function", "wgetenv_s function", "_wgetenv_s function", "getenv_s function", "environment variables", "tgetenv_s function"]
1011
ms.assetid: c3ae1ffe-d4cd-4bae-bcb1-3afa754c613a
12+
no-loc: [getenv_s, _wgetenv_s, _putenv_s, main, wmain, errno, EINVAL, ERANGE, _environ, _wenviron, _putenv, _wputenv, _tgetenv_s, _tzset, _dupenv_s, _wdupenv_s]
1113
---
1214
# getenv_s, _wgetenv_s
1315

@@ -77,7 +79,7 @@ Also, if the buffer is too small, these functions return **ERANGE**. They do not
7779

7880
## Remarks
7981

80-
The **getenv_s** function searches the list of environment variables for *varname*. **getenv_s** is not case sensitive in the Windows operating system. **getenv_s** and [_putenv_s](putenv-s-wputenv-s.md) use the copy of the environment that's pointed to by the global variable **_environ** to access the environment. **getenv_s** operates only on the data structures that are accessible to the run-time library and not on the environment "segment" that's created for the process by the operating system. Therefore, programs that use the *envp* argument to [main](../../cpp/main-program-startup.md) or [wmain](../../cpp/main-program-startup.md) might retrieve invalid information.
82+
The **getenv_s** function searches the list of environment variables for *varname*. **getenv_s** is not case sensitive in the Windows operating system. **getenv_s** and [_putenv_s](putenv-s-wputenv-s.md) use the copy of the environment that's pointed to by the global variable **_environ** to access the environment. **getenv_s** operates only on the data structures that are accessible to the run-time library and not on the environment "segment" that's created for the process by the operating system. Therefore, programs that use the *envp* argument to [main](../../cpp/main-function-command-line-args.md) or [wmain](../../cpp/main-function-command-line-args.md) might retrieve invalid information.
8183

8284
**_wgetenv_s** is a wide-character version of **getenv_s**; the argument and return value of **_wgetenv_s** are wide-character strings. The **_wenviron** global variable is a wide-character version of **_environ**.
8385

docs/c-runtime-library/reference/getenv-wgetenv.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
---
22
title: "getenv, _wgetenv"
3-
ms.date: "11/04/2016"
3+
description: "Describes the Microsoft C runtime library getenv and _wgetenv functions."
4+
ms.date: "01/15/2020"
45
api_name: ["getenv", "_wgetenv"]
56
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-environment-l1-1-0.dll"]
67
api_type: ["DLLExport"]
78
topic_type: ["apiref"]
89
f1_keywords: ["_wgetenv", "getenv", "_tgetenv"]
910
helpviewer_keywords: ["getenv function", "tgetenv function", "wgetenv function", "environment values", "environment variables", "_tgetenv function", "_wgetenv function"]
1011
ms.assetid: 3b9cb9ab-a126-4e0e-a44f-6c5a7134daf4
12+
no-loc: [getenv, _wgetenv, getenv_s, _wgetenv_s, _putenv_s, main, wmain, errno, EINVAL, ERANGE, _environ, _wenviron, _putenv, _wputenv, _tgetenv_s, _tzset, _dupenv_s, _wdupenv_s]
1113
---
1214
# getenv, _wgetenv
1315

@@ -32,13 +34,13 @@ wchar_t *_wgetenv(
3234
*varname*<br/>
3335
Environment variable name.
3436

35-
## Return Value
37+
## Return value
3638

3739
Returns a pointer to the environment table entry containing *varname*. It is not safe to modify the value of the environment variable using the returned pointer. Use the [_putenv](putenv-wputenv.md) function to modify the value of an environment variable. The return value is **NULL** if *varname* is not found in the environment table.
3840

3941
## Remarks
4042

41-
The **getenv** function searches the list of environment variables for *varname*. **getenv** is not case sensitive in the Windows operating system. **getenv** and **_putenv** use the copy of the environment pointed to by the global variable **_environ** to access the environment. **getenv** operates only on the data structures accessible to the run-time library and not on the environment "segment" created for the process by the operating system. Therefore, programs that use the *envp* argument to [main](../../cpp/main-program-startup.md) or [wmain](../../cpp/main-program-startup.md) may retrieve invalid information.
43+
The **getenv** function searches the list of environment variables for *varname*. **getenv** is not case sensitive in the Windows operating system. **getenv** and **_putenv** use the copy of the environment pointed to by the global variable **_environ** to access the environment. **getenv** operates only on the data structures accessible to the run-time library and not on the environment "segment" created for the process by the operating system. Therefore, programs that use the *envp* argument to [main](../../cpp/main-function-command-line-args.md) or [wmain](../../cpp/main-function-command-line-args.md) may retrieve invalid information.
4244

4345
If *varname* is **NULL**, this function invokes an invalid parameter handler, as described in [Parameter Validation](../../c-runtime-library/parameter-validation.md). If execution is allowed to continue, this function sets **errno** to **EINVAL** and returns **NULL**.
4446

@@ -117,6 +119,6 @@ New LIB variable is: c:\mylib;c:\yourlib
117119

118120
## See also
119121

120-
[Process and Environment Control](../../c-runtime-library/process-and-environment-control.md)<br/>
122+
[Process and environment control](../../c-runtime-library/process-and-environment-control.md)<br/>
121123
[_putenv, _wputenv](putenv-wputenv.md)<br/>
122-
[Environmental Constants](../../c-runtime-library/environmental-constants.md)<br/>
124+
[Environmental constants](../../c-runtime-library/environmental-constants.md)<br/>
Lines changed: 39 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,70 +1,79 @@
11
---
22
title: "strtol, wcstol, _strtol_l, _wcstol_l"
3-
ms.date: "11/04/2016"
3+
ms.date: "01/14/2020"
44
api_name: ["strtol", "wcstol", "_strtol_l", "_wcstol_l"]
55
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-convert-l1-1-0.dll"]
66
api_type: ["DLLExport"]
77
topic_type: ["apiref"]
88
f1_keywords: ["_wcstol_l", "strtol", "_tcstol", "wcstol", "_strtol_l", "_tcstol_l"]
99
helpviewer_keywords: ["wcstol function", "wcstol_l function", "_tcstol function", "string conversion, to integers", "tcstol function", "strtol_l function", "_wcstol_l function", "_strtol_l function", "strtol function"]
1010
ms.assetid: 1787c96a-f283-4a83-9325-33cfc1c7e240
11+
no-loc: [strtol, wcstol, _strtol_l, _wcstol_l, LONG_MAX, LONG_MIN, errno, ERANGE, EINVAL, LC_NUMERIC, _tcstol, _tcstol_l, localeconv, setlocale, _wsetlocale, strtod, _strtod_l, wcstod, _wcstod_l, strtoll, _strtoll_l, wcstoll, _wcstoll_l, strtoul, _strtoul_l, wcstoul, _wcstoul_l, atof, _atof_l, _wtof, _wtof_l]
1112
---
1213
# strtol, wcstol, _strtol_l, _wcstol_l
1314

14-
Convert strings to a long-integer value.
15+
Convert strings to a **long** integer value.
1516

1617
## Syntax
1718

1819
```C
1920
long strtol(
20-
const char *strSource,
21-
char **endptr,
21+
const char *string,
22+
char **end_ptr,
2223
int base
2324
);
2425
long wcstol(
25-
const wchar_t *strSource,
26-
wchar_t **endptr,
26+
const wchar_t *string,
27+
wchar_t **end_ptr,
2728
int base
2829
);
2930
long _strtol_l(
30-
const char *strSource,
31-
char **endptr,
31+
const char *string,
32+
char **end_ptr,
3233
int base,
3334
_locale_t locale
3435
);
3536
long _wcstol_l(
36-
const wchar_t *strSource,
37-
wchar_t **endptr,
37+
const wchar_t *string,
38+
wchar_t **end_ptr,
3839
int base,
3940
_locale_t locale
4041
);
4142
```
4243

4344
### Parameters
4445

45-
*strSource*<br/>
46+
*string*\
4647
Null-terminated string to convert.
4748

48-
*endptr*<br/>
49-
Pointer to character that stops scan.
49+
*end_ptr*\
50+
An output parameter, set to point to the character after the last interpreted character. Ignored, if **NULL**.
5051

51-
*base*<br/>
52+
*base*\
5253
Number base to use.
5354

54-
*locale*<br/>
55+
*locale*\
5556
Locale to use.
5657

5758
## Return Value
5859

59-
**strtol** returns the value represented in the string *strSource*, except when the representation would cause an overflow, in which case it returns **LONG_MAX** or **LONG_MIN**. **strtol** returns 0 if no conversion can be performed. **wcstol** returns values analogously to **strtol**. For both functions, **errno** is set to **ERANGE** if overflow or underflow occurs.
60+
**strtol**, **wcstol**, **_strtol_l**, and **_wcstol_l** return the value represented in *string*. They return 0 if no conversion is possible. When the representation would cause an overflow, they return **LONG_MAX** or **LONG_MIN**.
6061

61-
See [_doserrno, errno, _sys_errlist, and _sys_nerr](../../c-runtime-library/errno-doserrno-sys-errlist-and-sys-nerr.md) for more information on these and other return codes.
62+
**errno** is set to **ERANGE** if overflow or underflow occurs. It's set to **EINVAL** if *string* is **NULL**. Or, if *base* is nonzero and less than 2, or greater than 36. For more information on **ERANGE**, **EINVAL**, and other return codes, see [_doserrno, errno, _sys_errlist, and _sys_nerr](../../c-runtime-library/errno-doserrno-sys-errlist-and-sys-nerr.md).
6263

6364
## Remarks
6465

65-
The **strtol** function converts *strSource* to a **long**. **strtol** stops reading the string *strSource* at the first character it cannot recognize as part of a number. This may be the terminating null character, or it may be the first numeric character greater than or equal to *base*.
66+
The **strtol**, **wcstol**, **_strtol_l**, and **_wcstol_l** functions convert *string* to a **long**. They stop reading *string* at the first character not recognized as part of a number. It may be the terminating-null character, or the first alphanumeric character greater than or equal to *base*.
6667

67-
**wcstol** is a wide-character version of **strtol**; its *strSource* argument is a wide-character string. These functions behave identically otherwise.
68+
**wcstol** and **_wcstol_l** are wide-character versions of **strtol** and **_strtol_l**. Their *string* argument is a wide-character string. These functions behave identically to **strtol** and **_strtol_l** otherwise. The locale's **LC_NUMERIC** category setting determines recognition of the radix character (the fractional marker or decimal point) in *string*. The functions **strtol** and **wcstol** use the current locale. **_strtol_l** and **_wcstol_l** use the locale passed in instead. For more information, see [setlocale] and [Locale](../../c-runtime-library/locale.md).
69+
70+
When *end_ptr* is **NULL**, it's ignored. Otherwise, a pointer to the character that stopped the scan is stored at the location pointed to by *end_ptr*. No conversion is possible if no valid digits are found, or an invalid base is specified. The value of *string* is then stored at the location pointed to by *end_ptr*.
71+
72+
**strtol** expects *string* to point to a string of the following form:
73+
74+
> [*whitespace*] [{**+** &#124; **-**}] [**0** [{ **x** &#124; **X** }]] [*alphanumerics*]
75+
76+
Square brackets (`[ ]`) surround optional elements. Curly braces and a vertical bar (`{ | }`) surround alternatives for a single element. *whitespace* may consist of space and tab characters, which are ignored. *alphanumerics* are decimal digits or the letters 'a' through 'z' (or 'A' through 'Z'). The first character that doesn't fit this form stops the scan. If *base* is between 2 and 36, then it's used as the base of the number. If *base* is 0, the initial characters of the string pointed to by *string* are used to determine the base. If the first character is 0, and the second character isn't 'x' or 'X', the string is interpreted as an octal integer. If the first character is '0' and the second character is 'x' or 'X', the string is interpreted as a hexadecimal integer. If the first character is '1' through '9', the string is interpreted as a decimal integer. The letters 'a' through 'z' (or 'A' through 'Z') are assigned the values 10 through 35. The scan only allows letters whose values are less than *base*. The first character outside the range of the base stops the scan. For example, suppose *string* starts with "01". If *base* is 0, the scanner assumes it's an octal integer. An '8' or '9' character stops the scan.
6877

6978
### Generic-Text Routine Mappings
7079

@@ -73,37 +82,29 @@ The **strtol** function converts *strSource* to a **long**. **strtol** stops rea
7382
|**_tcstol**|**strtol**|**strtol**|**wcstol**|
7483
|**_tcstol_l**|**_strtol_l**|**_strtol_l**|**_wcstol_l**|
7584

76-
The current locale's **LC_NUMERIC** category setting determines recognition of the radix character in *strSource*; for more information, see [setlocale](setlocale-wsetlocale.md). The functions without the **_l** suffix use the current locale; **_strtol_l** and **_wcstol_l** are identical to the corresponding functions without the **_l** suffix except that they use the locale passed in instead. For more information, see [Locale](../../c-runtime-library/locale.md).
77-
78-
If *endptr* is not **NULL**, a pointer to the character that stopped the scan is stored at the location pointed to by *endptr*. If no conversion can be performed (no valid digits were found or an invalid base was specified), the value of *strSource* is stored at the location pointed to by *endptr*.
79-
80-
**strtol** expects *strSource* to point to a string of the following form:
81-
82-
> [*whitespace*] [{**+** &#124; **-**}] [**0** [{ **x** &#124; **X** }]] [*digits* &#124; *letters*]
83-
84-
A *whitespace* may consist of space and tab characters, which are ignored; *digits* are one or more decimal digits; *letters* are one or more of the letters 'a' through 'z' (or 'A' through 'Z'). The first character that does not fit this form stops the scan. If *base* is between 2 and 36, then it is used as the base of the number. If *base* is 0, the initial characters of the string pointed to by *strSource* are used to determine the base. If the first character is 0 and the second character is not 'x' or 'X', the string is interpreted as an octal integer. If the first character is '0' and the second character is 'x' or 'X', the string is interpreted as a hexadecimal integer. If the first character is '1' through '9', the string is interpreted as a decimal integer. The letters 'a' through 'z' (or 'A' through 'Z') are assigned the values 10 through 35; only letters whose assigned values are less than *base* are permitted. The first character outside the range of the base stops the scan. For example, if *base* is 0 and the first character scanned is '0', an octal integer is assumed and an '8' or '9' character will stop the scan.
85-
8685
## Requirements
8786

8887
|Routine|Required header|
8988
|-------------|---------------------|
9089
|**strtol**|\<stdlib.h>|
9190
|**wcstol**|\<stdlib.h> or \<wchar.h>|
9291
|**_strtol_l**|\<stdlib.h>|
92+
|**_wcstol_l**|\<stdlib.h> or \<wchar.h>|
9393

94-
For additional compatibility information, see [Compatibility](../../c-runtime-library/compatibility.md).
94+
The **_strtol_l** and **_wcstol_l** functions are Microsoft-specific, not part of the Standard C library. For additional compatibility information, see [Compatibility](../compatibility.md).
9595

9696
## Example
9797

9898
See the example for [strtod](strtod-strtod-l-wcstod-wcstod-l.md).
9999

100100
## See also
101101

102-
[Data Conversion](../../c-runtime-library/data-conversion.md)<br/>
103-
[Locale](../../c-runtime-library/locale.md)<br/>
104-
[localeconv](localeconv.md)<br/>
105-
[setlocale, _wsetlocale](setlocale-wsetlocale.md)<br/>
106-
[String to Numeric Value Functions](../../c-runtime-library/string-to-numeric-value-functions.md)<br/>
107-
[strtod, _strtod_l, wcstod, _wcstod_l](strtod-strtod-l-wcstod-wcstod-l.md)<br/>
108-
[strtoul, _strtoul_l, wcstoul, _wcstoul_l](strtoul-strtoul-l-wcstoul-wcstoul-l.md)<br/>
109-
[atof, _atof_l, _wtof, _wtof_l](atof-atof-l-wtof-wtof-l.md)<br/>
102+
[Data conversion](../data-conversion.md)\
103+
[Locale](../locale.md)\
104+
[localeconv](localeconv.md)\
105+
[setlocale, _wsetlocale](setlocale-wsetlocale.md)\
106+
[String to numeric value functions](../string-to-numeric-value-functions.md)\
107+
[strtod, _strtod_l, wcstod, _wcstod_l](strtod-strtod-l-wcstod-wcstod-l.md)\
108+
[strtoll, _strtoll_l, wcstoll, _wcstoll_l](strtoll-strtoll-l-wcstoll-wcstoll-l.md)\
109+
[strtoul, _strtoul_l, wcstoul, _wcstoul_l](strtoul-strtoul-l-wcstoul-wcstoul-l.md)\
110+
[atof, _atof_l, _wtof, _wtof_l](atof-atof-l-wtof-wtof-l.md)

docs/cpp/initializers.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ int main() {
165165
}
166166
```
167167
168-
For more information about initialization of global static objects, see [Additional Startup Considerations](../cpp/additional-startup-considerations.md).
168+
For more information about initialization of global static objects, see [main function and command-line arguments](main-function-command-line-args.md).
169169
170170
### Value initialization
171171
@@ -532,4 +532,4 @@ References that are not qualified with either the **const** or **volatile** keyw
532532

533533
### Initialization of external variables
534534

535-
Declarations of automatic, static, and external variables can contain initializers. However, declarations of external variables can contain initializers only if the variables are not declared as **extern**.
535+
Declarations of automatic, static, and external variables can contain initializers. However, declarations of external variables can contain initializers only if the variables are not declared as **extern**.

0 commit comments

Comments
 (0)