Skip to content

Commit b22a418

Browse files
authored
Merge pull request MicrosoftDocs#2641 from corob-msft/cr-1848-1849-filesystem
Fixes for filesystem per 1848, 1849
2 parents 952cba4 + ba982a6 commit b22a418

1 file changed

Lines changed: 43 additions & 41 deletions

File tree

Lines changed: 43 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,100 +1,103 @@
11
---
22
title: "<filesystem>"
3-
ms.date: "11/04/2016"
3+
description: "Describes the classes, functions, and types in the filesystem header of the Standard C++ library."
4+
ms.date: "01/22/2020"
45
f1_keywords: ["filesystem/std::experimental::filesystem::directory_entry", "filesystem/std::experimental::filesystem::recursive_directory_iterator", "filesystem/std::experimental::filesystem::path", "filesystem/std::experimental::filesystem::filesystem_error", "filesystem/std::experimental::filesystem::directory_iterator", "<filesystem>"]
56
ms.assetid: 5005753b-46fa-43e1-8d4e-1b38617d3cfd
7+
no-loc: [filesystem, experimental, char, wchar_t, char16_t, char32_t]
68
---
79
# &lt;filesystem&gt;
810

9-
Include the header &lt;filesystem> for access to classes and functions that manipulate and retrieve information about paths, files and directories.
11+
Include the header &lt;filesystem> for access to classes and functions that manipulate and retrieve information about paths, files, and directories.
1012

1113
## Syntax
1214

1315
```cpp
14-
#include <experimental/filesystem> // C++-standard header file name
15-
#include <filesystem> // Microsoft-specific implementation header file name
16+
#include <filesystem> // C++17 standard header file name
17+
#include <experimental/filesystem> // Header file for pre-standard implementation
1618
using namespace std::experimental::filesystem::v1;
1719
```
1820
1921
> [!IMPORTANT]
20-
> As of the release of Visual Studio 2017, the \<filesystem> header was not yet a C++ standard. C++ in Visual Studio 2017 (MSVC v141) implements the final draft standard, found in [ISO/IEC JTC 1/SC 22/WG 21 N4100](http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n4100.pdf).
22+
> At the release of Visual Studio 2017, the \<filesystem> header was not yet a C++ standard. C++ in Visual Studio 2017 RTW implements the final draft standard, found in [ISO/IEC JTC 1/SC 22/WG 21 N4100](http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n4100.pdf). Visual Studio 2017 version 15.7 and later supports the new C++17 \<filesystem> standard.
23+
> This is a completely new implementation, incompatible with the previous `std::experimental` version. It was made necessary by symlink support, bug fixes, and changes in standard-required behavior. Currently, including \<filesystem> provides the new `std::filesystem` and the previous `std::experimental::filesystem`. Including \<experimental/filesystem> provides only the old experimental implementation. The experimental implementation will be removed in the next ABI-breaking release of the libraries.
2124
22-
This header supports filesystems for one of two broad classes of host operating systems: Microsoft Windows and POSIX.
25+
This header supports file systems for one of two broad classes of host operating systems: Microsoft Windows and POSIX.
2326
2427
While most functionality is common to both operating systems, this document identifies where differences occur. For example:
2528
26-
- Windows supports multiple root names, such as c: or \\\network_name. A filesystem consists of a forest of trees, each with its own root directory, such as c:\ or \\\network_name\\, and each with its own current directory, for completing a relative pathname (one that is not an absolute pathname).
29+
- Windows supports multiple root names, such as `c:` or `\\network_name`. A file system consists of a forest of trees, each with its own root directory, such as `c:\` or `\\network_name\`, and each with its own current directory, for completing a relative pathname (one that's not an absolute pathname).
2730
28-
- POSIX supports a single tree, with no root name, the single root directory /, and a single current directory.
31+
- POSIX supports a single tree, with no root name, the single root directory `/`, and a single current directory.
2932
3033
Another significant difference is the native representation of pathnames:
3134
32-
- Windows uses a null-terminated sequence of wchar_t, encoded as UTF-16 (one or two elements for each character).
35+
- Windows uses a null-terminated sequence of **wchar_t**, encoded as UTF-16 (one or more elements for each character).
3336
34-
- POSIX uses a null-terminated sequence of char, encoded as UTF-8 (one or more elements for each character).
37+
- POSIX uses a null-terminated sequence of **char**, encoded as UTF-8 (one or more elements for each character).
3538
36-
- An object of class path stores the pathname in native form, but supports easy conversion between this stored form and several external forms:
39+
- An object of class `path` stores the pathname in native form, but supports easy conversion between this stored form and several external forms:
3740
38-
- A null-terminated sequence of char, encoded as favored by the operating system.
41+
- A null-terminated sequence of **char**, encoded as favored by the operating system.
3942
40-
- A null-terminated sequence of char, encoded as UTF-8.
43+
- A null-terminated sequence of **char**, encoded as UTF-8.
4144
42-
- A null-terminated sequence of wchar_t, encoded as favored by the operating system.
45+
- A null-terminated sequence of **wchar_t**, encoded as favored by the operating system.
4346
44-
- A null-terminated sequence of char16_t, encoded as UTF-16.
47+
- A null-terminated sequence of **char16_t**, encoded as UTF-16.
4548
46-
- A null-terminated sequence of char32_t, encoded as UTF-32.
49+
- A null-terminated sequence of **char32_t**, encoded as UTF-32.
4750
48-
Interconversions between these representations are mediated, as needed, by the use of one or more `codecvt` facets. If a specific locale object is not designated, these facets are obtained from the global locale.
51+
Interconversions between these representations are mediated, as needed, by the use of one or more `codecvt` facets. If no specific locale object is specified, these facets are obtained from the global locale.
4952
5053
Another difference is the detail with which each operating system lets you specify file or directory access permissions:
5154
52-
1. Windows records whether a file is read only or writable, an attribute that has no meaning for directories.
55+
- Windows records whether a file is read-only or writable, an attribute that has no meaning for directories.
5356
54-
1. POSIX records whether a file can be read, written, or executed (scanned if a directory), by the owner, by the owner's group, or by everybody, plus a few other permissions.
57+
- POSIX records whether a file can be read, written, or executed (scanned, if a directory). And, whether each operation is allowed for the owner, the owner's group, or for everybody, plus a few other permissions.
5558
56-
Common to both systems is the structure imposed on a pathname once you get past the root name. For the pathname c:/abc/xyz/def.ext:
59+
Common to both systems is the structure imposed on a pathname once you get past the root name. For the pathname `c:/abc/xyz/def.ext`:
5760
58-
- The root name is c:.
61+
- The root name is `c:`.
5962
60-
- The root directory is /.
63+
- The root directory is `/`.
6164
62-
- The root path is c:/.
65+
- The root path is `c:/`.
6366
64-
- The relative path is abc/xyz/def.ext.
67+
- The relative path is `abc/xyz/def.ext`.
6568
66-
- The parent path is c:/abc/xyz.
69+
- The parent path is `c:/abc/xyz`.
6770
68-
- The filename is def.ext.
71+
- The filename is `def.ext`.
6972
70-
- The stem is def.
73+
- The stem is `def`.
7174
72-
- The extension is .ext.
75+
- The extension is `.ext`.
7376
74-
A minor difference is the **preferred separator**, between the sequence of directories in a pathname. Both operating systems let you write a forward slash /, but in some contexts Windows prefers a backslash \\.
77+
A minor difference is the preferred separator between the sequence of directories in a pathname. Both operating systems let you write a forward slash `/`, but in some contexts Windows prefers a backslash `\`. The implementation stores its preferred separator in the data member `preferred_separator` in `path`.
7578
76-
Finally, an important feature of path objects is that you can use them wherever a filename argument is required in the classes defined in the header \<fstream>.
79+
Finally, `path` objects have an important feature: You can use them wherever a filename argument is required in the classes defined in the header [\<fstream>](fstream.md).
7780
78-
For more information and code examples, see [File System Navigation (C++)](../standard-library/file-system-navigation.md).
81+
For more information and code examples, see [File system navigation (C++)](../standard-library/file-system-navigation.md).
7982
8083
## Members
8184
8285
### Classes
8386
8487
|||
8588
|-|-|
86-
|[directory_entry Class](../standard-library/directory-entry-class.md)|Describes an object that is returned by a `directory_iterator` or a `recursive_directory_iterator` and contains a path.|
87-
|[directory_iterator Class](../standard-library/directory-iterator-class.md)|Describes an input iterator that sequences through the file names in a file-system directory.|
88-
|[filesystem_error Class](../standard-library/filesystem-error-class.md)|A base class for exceptions that are thrown to report a low-level system overflow.|
89-
|[path Class](../standard-library/path-class.md)|Defines a class that stores an object of template type `String` that is suitable for use as a file name.|
90-
|[recursive_directory_iterator Class](../standard-library/recursive-directory-iterator-class.md)|Describes an input iterator that sequences through the file names in a file-system directory. The iterator can also descend into subdirectories.|
91-
|[file_status Class](../standard-library/file-status-class.md)|Wraps a `file_type`.|
89+
|[directory_entry class](../standard-library/directory-entry-class.md)|Describes an object that is returned by a `directory_iterator` or a `recursive_directory_iterator` and contains a `path`.|
90+
|[directory_iterator class](../standard-library/directory-iterator-class.md)|Describes an input iterator that sequences through the file names in a file-system directory.|
91+
|[filesystem_error class](../standard-library/filesystem-error-class.md)|A base class for exceptions that are thrown to report a low-level system overflow.|
92+
|[path class](../standard-library/path-class.md)|Defines a class that stores an object of template type `String` that is suitable for use as a file name.|
93+
|[recursive_directory_iterator class](../standard-library/recursive-directory-iterator-class.md)|Describes an input iterator that sequences through the file names in a file-system directory. The iterator can also descend into subdirectories.|
94+
|[file_status class](../standard-library/file-status-class.md)|Wraps a `file_type`.|
9295
9396
### Structs
9497
9598
|||
9699
|-|-|
97-
|[space_info Structure](../standard-library/space-info-structure.md)|Holds information about a volume.|
100+
|[space_info structure](../standard-library/space-info-structure.md)|Holds information about a volume.|
98101
99102
## Functions
100103
@@ -109,12 +112,11 @@ For more information and code examples, see [File System Navigation (C++)](../st
109112
|||
110113
|-|-|
111114
|[copy_options](../standard-library/filesystem-enumerations.md#copy_options)|An enumeration that is used with [copy_file](../standard-library/filesystem-functions.md#copy_file) and determines behavior if a destination file already exists.|
112-
|[copy_options](../standard-library/filesystem-enumerations.md#copy_options)|An enumeration that is used with [copy_file](../standard-library/filesystem-functions.md#copy_file) and determines behavior if a destination file already exists.|
113115
|[directory_options](../standard-library/filesystem-enumerations.md#directory_options)|An enumeration that specifies options for directory iterators.|
114116
|[file_type](../standard-library/filesystem-enumerations.md#file_type)|An enumeration for file types.|
115-
|[perm_options](../standard-library/filesystem-enumerations.md#perm_options)||
117+
|[perm_options](../standard-library/filesystem-enumerations.md#perm_options)| Enumerates options for the `permissions` function. |
116118
|[perms](../standard-library/filesystem-enumerations.md#perms)|A bitmask type used to convey permissions and options to permissions|
117119
118120
## See also
119121
120-
[Header Files Reference](../standard-library/cpp-standard-library-header-files.md)
122+
[Header files reference](../standard-library/cpp-standard-library-header-files.md)

0 commit comments

Comments
 (0)