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
|[`is_absolute`](#is_absolute)|For Windows, the function returns `has_root_name() && has_root_directory()`. For POSIX, the function returns `has_root_directory()`.|
|[`make_preferred`](#make_preferred)|Converts each separator to a `preferred_separator` as needed.|
66
-
|[`native`](#native)|Returns `myname`.|
65
+
|[`native`](#native)|Returns the native representation of the path.|
67
66
|[`parent_path`](#parent_path)|Returns the parent path component of `myname`.|
68
67
|[`preferred_separator`](#preferred_separator)|The constant object gives the preferred character for separating path components, depending on the host operating system. |
69
68
|[`relative_path`](#relative_path)|Returns the relative path component of `myname`. |
@@ -436,12 +435,30 @@ path& make_preferred();
436
435
437
436
## <aname="native"></a> `path::native`
438
437
439
-
Returns `myname`.
438
+
Get the native string representation of the path.
440
439
441
440
```cpp
442
441
const string_type& native() constnoexcept;
443
442
```
444
443
444
+
### Remarks
445
+
446
+
The path is available in a portable generic format (see [`generic_string()`](#generic_string)). Or, you can get the native format of the path. This function returns the native string. On a POSIX system, the generic format and the native format are the same.
447
+
448
+
In the following example, tested on Windows 11, the generic path string is `c:/t/temp/temp.txt` and the native string is `c:\\t\\temp.txt`
449
+
450
+
```cpp
451
+
// Compile with /std:c++17 or higher
452
+
#include<filesystem>
453
+
454
+
intmain()
455
+
{
456
+
std::filesystem::path p(R"(c:\t\temp.txt)");
457
+
auto native = p.native(); // Windows: L"c:\\t\temp.txt"
458
+
auto generic = p.generic_string(); // Windows: "c:/t/temp.txt"
459
+
}
460
+
```
461
+
445
462
## <aname="op_as"></a> `path::operator=`
446
463
447
464
Replaces the elements of the path with a copy of another path.
0 commit comments