- filesystem[meta header]
- std::filesystem[meta namespace]
- path[meta class]
- function[meta id-type]
- cpp17[meta cpp]
std::u16string u16string() const;
UTF-16エンコードで、パス文字列を取得する。
*this
が保持するシステムのネイティブフォーマットを持つパスを、UTF-16エンコードで返す。
#include <iostream>
#include <filesystem>
namespace fs = std::filesystem;
int main()
{
fs::path p = "/usr/bin/clang";
const std::u16string s = p.u16string();
}
- p.u16string()[color ff0000]
#include <iostream>
#include <filesystem>
namespace fs = std::filesystem;
int main()
{
fs::path p = "foo/bar";
const std::u16string s = p.u16string();
}
- p.u16string()[color ff0000]
- C++17
- Clang:
- GCC: 8.1 [mark verified]
- Visual C++: 2017 Update 7 [mark verified]