最終更新日時(UTC):
が更新

履歴 編集

function
<filesystem>

std::filesystem::path::u16string(C++17)

std::u16string u16string() const;

概要

UTF-16エンコードで、パス文字列を取得する。

戻り値

*thisが保持するシステムのネイティブフォーマットを持つパスを、UTF-16エンコードで返す。

POSIXベースシステムでの例

#include <iostream>
#include <filesystem>

namespace fs = std::filesystem;

int main()
{
  fs::path p = "/usr/bin/clang";
  const std::u16string s = p.u16string();
}

出力

Windowsでの例

#include <iostream>
#include <filesystem>

namespace fs = std::filesystem;

int main()
{
  fs::path p = "foo/bar";
  const std::u16string s = p.u16string();
}

出力

バージョン

言語

  • C++17

処理系