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
@@ -33,27 +32,27 @@ float abs( float n ); // C++ only
33
32
34
33
### Parameters
35
34
36
-
*n*\
35
+
*`n`*\
37
36
Numeric value.
38
37
39
38
## Return Value
40
39
41
-
The **abs**, **labs**, **llabs**, and **_abs64** functions return the absolute value of the parameter *n*. There's no error return.
40
+
The **`abs`**, **`labs`**, **`llabs`**, and **`_abs64`** functions return the absolute value of the parameter *`n`*. There's no error return.
42
41
43
42
## Remarks
44
43
45
-
Because C++ allows overloading, you can call overloads of **abs** that take and return **`long`**, **`long long`**, **`float`**, **`double`**, and **`long double`** values. These overloads are defined in the \<cmath> header. In a C program, **abs** always takes and returns an **`int`**.
44
+
Because C++ allows overloading, you can call overloads of **`abs`** that take and return **`long`**, **`long long`**, **`float`**, **`double`**, and **`long double`** values. These overloads are defined in the `<cmath>` header. In a C program, **`abs`** always takes and returns an **`int`**.
46
45
47
-
**Microsoft-specific**: Because the range of negative integers that can be represented by using any integral type is larger than the range of positive integers that can be represented by using that type, it's possible to supply an argument to these functions that can't be converted. If the absolute value of the argument cannot be represented by the return type, the **abs** functions return the argument value unchanged. Specifically, `abs(INT_MIN)` returns `INT_MIN`, `labs(LONG_MIN)` returns `LONG_MIN`, `llabs(LLONG_MIN)` returns `LLONG_MIN`, and `_abs64(_I64_MIN)` returns `_I64_MIN`. This means that the **abs** functions cannot be used to guarantee a positive value.
46
+
**Microsoft-specific**: Because the range of negative integers that can be represented by using any integral type is larger than the range of positive integers that can be represented by using that type, it's possible to supply an argument to these functions that can't be converted. If the absolute value of the argument can’t be represented by the return type, the **`abs`** functions return the argument value unchanged. Specifically, `abs(INT_MIN)` returns `INT_MIN`, `labs(LONG_MIN)` returns `LONG_MIN`, `llabs(LLONG_MIN)` returns `LLONG_MIN`, and `_abs64(_I64_MIN)` returns `_I64_MIN`. This means that the **`abs`** functions can’t be used to guarantee a positive value.
@@ -41,15 +40,15 @@ A pointer to a structure of type [`tm`](../../c-runtime-library/standard-types.m
41
40
|`tm_year`|Year (current year minus 1900).|
42
41
|`tm_wday`|Day of week (0 - 6; Sunday = 0).|
43
42
|`tm_yday`|Day of year (0 - 365; January 1 = 0).|
44
-
|`tm_isdst`|Always 0 for **gmtime**.|
43
+
|`tm_isdst`|Always 0 for **`gmtime`**.|
45
44
46
45
Both the 32-bit and 64-bit versions of **`gmtime`**, [`mktime`](mktime-mktime32-mktime64.md), [`mkgmtime`](mkgmtime-mkgmtime32-mkgmtime64.md), and [`localtime`](localtime-localtime32-localtime64.md) all use one common `tm` structure per thread for the conversion. Each call to one of these functions destroys the result of any previous call. If *`sourceTime`* represents a date before midnight, January 1, 1970, **`gmtime`** returns `NULL`. There's no error return.
47
46
48
-
**_gmtime64**, which uses the `__time64_t` structure, enables dates to be expressed up through 23:59:59, December 31, 3000, UTC. **`_gmtime32`** only represent dates through 23:59:59 January 18, 2038, UTC. Midnight, January 1, 1970, is the lower bound of the date range for both functions.
47
+
**`_gmtime64`**, which uses the `__time64_t` structure, enables dates to be expressed up through 23:59:59, December 31, 3000, UTC. **`_gmtime32`** only represent dates through 23:59:59 January 18, 2038, UTC. Midnight, January 1, 1970, is the lower bound of the date range for both functions.
49
48
50
-
**`gmtime`** is an inline function that evaluates to **`_gmtime64`**, and `time_t` is equivalent to `__time64_t` unless `_USE_32BIT_TIME_T` is defined. If you must force the compiler to interpret `time_t` as the old 32-bit `time_t`, you can define `_USE_32BIT_TIME_T`, but doing so causes **`gmtime`** to be in-lined to **`_gmtime32`** and `time_t` to be defined as `__time32_t`. We don't recommend that you do this, because it isn't allowed on 64-bit platforms. In any case, your application may fail after January 18, 2038.
49
+
**`gmtime`** is an inline function that evaluates to **`_gmtime64`**, and `time_t` is equivalent to `__time64_t` unless `_USE_32BIT_TIME_T` is defined. If you must force the compiler to interpret `time_t` as the old 32-bit `time_t`, you can define `_USE_32BIT_TIME_T`, but doing so causes **`gmtime`** to be in-lined to **`_gmtime32`** and `time_t` to be defined as `__time32_t`. We don't recommend that you do this, because it isn't allowed on 64-bit platforms. In any case, your application may fail after January 18, 2038.
51
50
52
-
These functions validate their parameters. If *`sourceTime`* is a null pointer, or if the *`sourceTime`* value is negative, these functions invoke an invalid parameter handler, as described in [Parameter validation](../../c-runtime-library/parameter-validation.md). If execution is allowed to continue, the functions return `NULL` and set `errno` to `EINVAL`.
51
+
These functions validate their parameters. If *`sourceTime`* is a `NULL` pointer, or if the *`sourceTime`* value is negative, these functions invoke an invalid parameter handler, as described in [Parameter validation](../../c-runtime-library/parameter-validation.md). If execution is allowed to continue, the functions return `NULL` and set `errno` to `EINVAL`.
Associates a C run-time file descriptor with an existing operating system file handle.
16
15
@@ -25,42 +24,42 @@ int _open_osfhandle (
25
24
26
25
### Parameters
27
26
28
-
*osfhandle*<br/>
27
+
*`osfhandle`*\
29
28
Operating system file handle.
30
29
31
-
*flags*<br/>
30
+
*`flags`*\
32
31
Types of operations allowed.
33
32
34
33
## Return Value
35
34
36
-
If successful, **_open_osfhandle** returns a C run-time file descriptor. Otherwise, it returns -1.
35
+
If successful, **`_open_osfhandle`** returns a C run-time file descriptor. Otherwise, it returns -1.
37
36
38
37
## Remarks
39
38
40
-
The **_open_osfhandle** function allocates a C run-time file descriptor. It associates this file descriptor with the operating system file handle specified by *osfhandle*. To avoid a compiler warning, cast the *osfhandle* argument from **HANDLE** to **intptr_t**. The *flags* argument is an integer expression formed from one or more of the manifest constants defined in \<fcntl.h>. You can use the bitwise-OR operator ( **|** ) to combine two or more manifest constants to form the *flags* argument.
39
+
The **`_open_osfhandle`** function allocates a C run-time file descriptor. It associates this file descriptor with the operating system file handle specified by *`osfhandle`*. To avoid a compiler warning, cast the *`osfhandle`* argument from **`HANDLE`** to **`intptr_t`**. The *`flags`* argument is an integer expression formed from one or more of the manifest constants defined in `<fcntl.h>`. You can use the bitwise "or" (`|`) operator to combine two or more manifest constants to form the *`flags`* argument.
41
40
42
-
These manifest constants are defined in \<fcntl.h>:
41
+
These manifest constants are defined in `<fcntl.h>`:
43
42
44
43
| Constant | Description |
45
44
|--|--|
46
-
|**\_O\_APPEND**| Positions a file pointer to the end of the file before every write operation. |
47
-
|**\_O\_RDONLY**| Opens the file for reading only. |
48
-
|**\_O\_TEXT**| Opens the file in text (translated) mode. |
49
-
|**\_O\_WTEXT**| Opens the file in Unicode (translated UTF-16) mode. |
45
+
|**`_O_APPEND`**| Positions a file pointer to the end of the file before every write operation. |
46
+
|**`_O_RDONLY`**| Opens the file for reading only. |
47
+
|**`_O_TEXT`**| Opens the file in text (translated) mode. |
48
+
|**`_O_WTEXT`**| Opens the file in Unicode (translated UTF-16) mode. |
50
49
51
-
The **_open_osfhandle** call transfers ownership of the Win32 file handle to the file descriptor. To close a file opened by using **_open_osfhandle**, call [\_close](close.md). The underlying OS file handle is also closed by a call to **_close**. Don't call the Win32 function **CloseHandle** on the original handle. If the file descriptor is owned by a `FILE *` stream, then a call to [fclose](fclose-fcloseall.md) closes both the file descriptor and the underlying handle. In this case, don't call **_close** on the file descriptor or **CloseHandle** on the original handle.
50
+
The **`_open_osfhandle`** call transfers ownership of the Win32 file handle to the file descriptor. To close a file opened by using **`_open_osfhandle`**, call [`_close`](close.md). The underlying OS file handle is also closed by a call to **`_close`**. Don't call the Win32 function **`CloseHandle`** on the original handle. If the file descriptor is owned by a `FILE *` stream, then a call to [`fclose`](fclose-fcloseall.md) closes both the file descriptor and the underlying handle. In this case, don't call **`_close`** on the file descriptor or **`CloseHandle`** on the original handle.
52
51
53
52
By default, this function's global state is scoped to the application. To change this, see [Global state in the CRT](../global-state.md).
54
53
55
54
## Requirements
56
55
57
56
|Routine|Required header|
58
57
|-------------|---------------------|
59
-
|**_open_osfhandle**|\<io.h>|
58
+
|**`_open_osfhandle`**|`<io.h>`|
60
59
61
60
For more compatibility information, see [Compatibility](../../c-runtime-library/compatibility.md).
Creates, modifies, or removes environment variables. More secure versions of these functions are available; see [_putenv_s, _wputenv_s](putenv-s-wputenv-s.md).
14
+
Creates, modifies, or removes environment variables. More secure versions of these functions are available; see [`_putenv_s`, `_wputenv_s`](putenv-s-wputenv-s.md).
16
15
17
16
> [!IMPORTANT]
18
17
> 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).
@@ -30,7 +29,7 @@ int _wputenv(
30
29
31
30
### Parameters
32
31
33
-
*envstring*<br/>
32
+
*`envstring`*\
34
33
Environment-string definition.
35
34
36
35
## Return Value
@@ -39,42 +38,42 @@ Return 0 if successful or -1 in the case of an error.
39
38
40
39
## Remarks
41
40
42
-
The **_putenv** function adds new environment variables or modifies the values of existing environment variables. Environment variables define the environment in which a process executes (for example, the default search path for libraries to be linked with a program). **_wputenv** is a wide-character version of **_putenv**; the *envstring* argument to **_wputenv** is a wide-character string.
41
+
The **`_putenv`** function adds new environment variables or modifies the values of existing environment variables. Environment variables define the environment in which a process executes (for example, the default search path for libraries to be linked with a program). **`_wputenv`** is a wide-character version of **`_putenv`**; the *`envstring`* argument to **`_wputenv`** is a wide-character string.
43
42
44
43
By default, this function's global state is scoped to the application. To change this, see [Global state in the CRT](../global-state.md).
45
44
46
45
### Generic-Text Routine Mappings
47
46
48
-
|Tchar.h routine|_UNICODE and _MBCS not defined|_MBCS defined|_UNICODE defined|
47
+
|`Tchar.h` routine|`_UNICODE and _MBCS` not defined|`_MBCS` defined|`_UNICODE` defined|
The *envstring* argument must be a pointer to a string of the form *varname*=*value_string*, where *varname* is the name of the environment variable to be added or modified and *value_string* is the variable's value. If *varname* is already part of the environment, its value is replaced by *value_string*; otherwise, the new *varname* variable and its *value_string* value are added to the environment. You can remove a variable from the environment by specifying an empty *value_string*, or in other words, by specifying only *varname*=.
51
+
The *`envstring`* argument must be a pointer to a string of the form *`varname=value_string`*, where *`varname`* is the name of the environment variable to be added or modified and *`value_string`* is the variable's value. If *`varname`* is already part of the environment, its value is replaced by *`value_string`*; otherwise, the new *`varname`* variable and its *`value_string`* value are added to the environment. You can remove a variable from the environment by specifying an empty *`value_string`*, or in other words, by specifying only *`varname`*=.
53
52
54
-
**_putenv** and **_wputenv** affect only the environment that is local to the current process; you cannot use them to modify the command-level environment. That is, these functions operate only on data structures accessible to the run-time library and not on the environment segment created for a process by the operating system. When the current process terminates, the environment reverts to the level of the calling process (in most cases, the operating-system level). However, the modified environment can be passed to any new processes created by **_spawn**, **_exec**, or **system**, and these new processes get any new items added by **_putenv** and **_wputenv**.
53
+
**`_putenv`** and **`_wputenv`** affect only the environment that is local to the current process; you can’t use them to modify the command-level environment. That is, these functions operate only on data structures accessible to the run-time library and not on the environment segment created for a process by the operating system. When the current process terminates, the environment reverts to the level of the calling process (in most cases, the operating-system level). However, the modified environment can be passed to any new processes created by **`_spawn`**, **`_exec`**, or **`system`**, and these new processes get any new items added by **`_putenv`** and **`_wputenv`**.
55
54
56
-
Do not change an environment entry directly: instead, use **_putenv** or **_wputenv** to change it. In particular, direct freeing elements of the **_environ[]** global array might lead to invalid memory being addressed.
55
+
Don't change an environment entry directly: instead, use **`_putenv`** or **`_wputenv`** to change it. In particular, direct freeing elements of the **`_environ[]`** global array might lead to invalid memory being addressed.
57
56
58
-
**getenv** and **_putenv** use the global variable **_environ** to access the environment table; **_wgetenv** and **_wputenv** use **_wenviron**. **_putenv** and **_wputenv** might change the value of **_environ** and **_wenviron**, thus invalidating the **_envp** argument to **main** and the **_wenvp** argument to **wmain**. Therefore, it is safer to use **_environ** or **_wenviron** to access the environment information. For more information about the relation of **_putenv** and **_wputenv** to global variables, see [_environ, _wenviron](../../c-runtime-library/environ-wenviron.md).
57
+
**`_getenv`** and **`_putenv`** use the global variable **`_environ`** to access the environment table; **`_wgetenv`** and **`_wputenv`** use **`_wenviron`**. **`_putenv`** and **`_wputenv`** might change the value of **`_environ`** and **`_wenviron`**, thus invalidating the **`_envp`** argument to **`main`** and the **`_wenvp`** argument to **`wmain`**. Therefore, it's safer to use **`_environ`** or **`_wenviron`** to access the environment information. For more information about the relation of **`_putenv`** and **`_wputenv`** to global variables, see [`_environ`, `_wenviron`](../../c-runtime-library/environ-wenviron.md).
59
58
60
59
> [!NOTE]
61
-
> The **_putenv** and **_getenv** families of functions are not thread-safe. **_getenv** could return a string pointer while **_putenv** is modifying the string, causing random failures. Make sure that calls to these functions are synchronized.
60
+
> The **`_putenv`** and **`_getenv`** families of functions are not thread-safe. **`_getenv`** could return a string pointer while **`_putenv`** is modifying the string, causing random failures. Make sure that calls to these functions are synchronized.
62
61
63
62
## Requirements
64
63
65
64
|Routine|Required header|
66
65
|-------------|---------------------|
67
-
|**_putenv**|\<stdlib.h>|
68
-
|**_wputenv**|\<stdlib.h> or \<wchar.h>|
66
+
|**`_putenv`**|`<stdlib.h>`|
67
+
|**`_wputenv`**|`<stdlib.h>` or `<wchar.h>`|
69
68
70
69
For more compatibility information, see [Compatibility](../../c-runtime-library/compatibility.md).
71
70
72
71
## Example
73
72
74
-
For a sample of how to use **_putenv**, see [getenv, _wgetenv](getenv-wgetenv.md).
73
+
For a sample of how to use **`_putenv`**, see [`getenv`, `_wgetenv`](getenv-wgetenv.md).
75
74
76
75
## See also
77
76
78
-
[Process and Environment Control](../../c-runtime-library/process-and-environment-control.md)<br/>
0 commit comments