Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 13 additions & 13 deletions docs/c-runtime-library/reference/popen-wpopen.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
---
title: "_popen, _wpopen"
ms.date: "11/04/2016"
description: "A reference for the Microsoft C runtime (CRT) library functions _popen and _wpopen."
ms.date: "01/28/2020"
api_name: ["_popen", "_wpopen"]
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-stdio-l1-1-0.dll"]
api_type: ["DLLExport"]
topic_type: ["apiref"]
f1_keywords: ["tpopen", "popen", "wpopen", "_popen", "_wpopen", "_tpopen"]
helpviewer_keywords: ["tpopen function", "pipes, creating", "_popen function", "_tpopen function", "popen function", "wpopen function", "_wpopen function"]
ms.assetid: eb718ff2-c87d-4bd4-bd2e-ba317c3d6973
no-loc: [_popen, _wpopen, _tpopen, _doserrno, errno, _sys_errlist, _sys_nerr, EINVAL]
---
# _popen, _wpopen

Expand All @@ -31,21 +33,21 @@ FILE *_wpopen(

### Parameters

*command*<br/>
*command*\
Command to be executed.

*mode*<br/>
*mode*\
Mode of the returned stream.

## Return Value
## Return value

Returns a stream associated with one end of the created pipe. The other end of the pipe is associated with the spawned command's standard input or standard output. The functions return **NULL** on an error. If the error is an invalid parameter, such as if *command* or *mode* is a null pointer, or *mode* is not a valid mode, **errno** is set to **EINVAL**. See the Remarks section for valid modes.
Returns a stream associated with one end of the created pipe. The other end of the pipe is associated with the spawned command's standard input or standard output. The functions return **NULL** on an error. If the error is caused by an invalid parameter, **errno** is set to **EINVAL**. See the Remarks section for valid modes.

For information about these and other error codes, see [_doserrno, errno, _sys_errlist, and _sys_nerr](../../c-runtime-library/errno-doserrno-sys-errlist-and-sys-nerr.md).

## Remarks

The **_popen** function creates a pipe and asynchronously executes a spawned copy of the command processor with the specified string *command*. The character string *mode* specifies the type of access requested, as follows.
The **_popen** function creates a pipe. It then asynchronously executes a spawned copy of the command processor, and uses *command* as the command line. The character string *mode* specifies the type of access requested, as follows.

|Access mode|Description|
|-|-|
Expand Down Expand Up @@ -107,7 +109,7 @@ int main( void )

while(fgets(psBuffer, 128, pPipe))
{
printf(psBuffer);
puts(psBuffer);
}

/* Close pipe and print return value of pPipe. */
Expand All @@ -122,9 +124,7 @@ int main( void )
}
```

### Sample Output

This output assumes that there is only one file in the current directory with a .c file name extension.
This output assumes there's only one file in the current directory that has a `.c` file name extension.

```Output
Volume in drive C is CDRIVE
Expand All @@ -141,6 +141,6 @@ Process returned 0

## See also

[Process and Environment Control](../../c-runtime-library/process-and-environment-control.md)<br/>
[_pclose](pclose.md)<br/>
[_pipe](pipe.md)<br/>
[Process and environment control](../../c-runtime-library/process-and-environment-control.md)\
[_pclose](pclose.md)\
[_pipe](pipe.md)
61 changes: 28 additions & 33 deletions docs/standard-library/initializer-list-class.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
---
title: "initializer_list Class"
ms.date: "11/04/2016"
title: "initializer_list class"
description: "A reference for the initializer_list class in the C++ Standard library, as implemented by Microsoft in Visual Studio."
ms.date: "01/28/2020"
f1_keywords: ["initializer_list/std::initializer_list::initializer_list", "initializer_list/std::initializer_list::begin", "initializer_list/std::initializer_list::end", "initializer_list/std::initializer_list::size"]
ms.assetid: 1f2c0ff4-5636-4f79-b008-e75426e3d2ab
helpviewer_keywords: ["std::initializer_list::initializer_list", "std::initializer_list::begin", "std::initializer_list::end", "std::initializer_list::size"]
---
# initializer_list Class
# initializer_list class

Provides access to an array of elements in which each member is of the specified type.

Expand All @@ -18,9 +19,8 @@ class initializer_list

### Parameters

|Parameter|Description|
|---------------|-----------------|
|*Type*|The element data type to be stored in the `initializer_list`.|
*Type*\
The element data type to be stored in the `initializer_list`.

## Remarks

Expand All @@ -30,24 +30,24 @@ An `initializer_list` can be constructed using a braced initializer list:
initializer_list<int> i1{ 1, 2, 3, 4 };
```

The compiler transforms braced initializer lists with homogeneous elements into an `initializer_list` whenever the function signature requires an `initializer_list`. For more details on using `initializer_list`, see [Uniform Initialization and Delegating Constructors](../cpp/uniform-initialization-and-delegating-constructors.md)
The compiler transforms braced initializer lists with homogeneous elements into an `initializer_list` whenever the function signature requires an `initializer_list`. For more information about using `initializer_list`, see [Uniform initialization and delegating constructors](../cpp/uniform-initialization-and-delegating-constructors.md)

### Constructors

|Constructor|Description|
|-|-|
|[initializer_list](../standard-library/forward-list-class.md#forward_list)|Constructs an object of type `initializer_list`.|
|[initializer_list](#initializer_list)|Constructs an object of type `initializer_list`.|

### Typedefs

|Type name|Description|
|-|-|
|value_type|The type of the elements in the `initializer_list`.|
|reference|A type that provides a reference to an element in the `initializer_list`.|
|const_reference|A type that provides a constant reference to an element in the `initializer_list`.|
|size_type|A type that represents the number of elements in the `initializer_list`.|
|iterator|A type that provides an iterator for the `initializer_list`.|
|const_iterator|A type that provides a constant iterator for the `initializer_list`.|
|`value_type`|The type of the elements in the `initializer_list`.|
|`reference`|A type that provides a reference to an element in the `initializer_list`.|
|`const_reference`|A type that provides a constant reference to an element in the `initializer_list`.|
|`size_type`|A type that represents the number of elements in the `initializer_list`.|
|`iterator`|A type that provides an iterator for the `initializer_list`.|
|`const_iterator`|A type that provides a constant iterator for the `initializer_list`.|

### Member functions

Expand All @@ -71,12 +71,10 @@ Returns a pointer to the first element in an `initializer_list`.
constexpr const InputIterator* begin() const noexcept;
```

### Return Value
### Return value

A pointer to the first element of the `initializer_list`. If the list is empty, the pointer is the same for the beginning and end of the list.

### Remarks

## <a name="end"></a> initializer_list::end

Returns a pointer to one past the last element in an `initializer list`.
Expand All @@ -85,9 +83,9 @@ Returns a pointer to one past the last element in an `initializer list`.
constexpr const InputIterator* end() const noexcept;
```

### Return Value
### Return value

A pointer to one past the last element in the list. If the list is empty, this is the same as the pointer to the first element in the list.
A pointer to one past the last element in the list. If the list is empty, it's the same as the pointer to the first element in the list.

## <a name="initializer_list"></a> initializer_list::initializer_list

Expand All @@ -100,14 +98,15 @@ initializer_list(const InputIterator First, const InputIterator Last);

### Parameters

|Parameter|Description|
|---------------|-----------------|
|*First*|The position of the first element in the range of elements to be copied.|
|*Last*|The position of the first element beyond the range of elements to be copied.|
*First*\
The position of the first element in the range of elements to be copied.

*Last*\
The position of the first element beyond the range of elements to be copied.

### Remarks

An `initializer_list` is based on an array of objects of the specified type. Copying an `initializer_list` creates a second instance of a list pointing to the same objects; the underlying objects are not copied.
An `initializer_list` is based on an array of objects of the specified type. Copying an `initializer_list` creates a second instance of a list pointing to the same objects; the underlying objects aren't copied.

### Example

Expand Down Expand Up @@ -156,11 +155,6 @@ int main()
cout << " " << c;
cout << endl;

cout << "c4 =";
for (auto c : c4)
cout << " " << c;
cout << endl;

cout << "c5 =";
for (auto c : c5)
cout << " " << c;
Expand All @@ -169,7 +163,10 @@ int main()
```

```Output
c1 = 3c2 = 5 4 3 2 1c3 = 5 4 3 2 1c4 = 5 4c5 = 5 4
c1 = 3
c2 = 5 4 3 2 1
c3 = 5 4 3 2 1
c5 = 5 4
```

## <a name="size"></a> initializer_list::size
Expand All @@ -180,12 +177,10 @@ Returns the number of elements in the list.
constexpr size_t size() const noexcept;
```

### Return Value
### Return value

The number of elements in the list.

### Remarks

## See also

[<forward_list>](../standard-library/forward-list.md)