概要
エラーとなったふたつめのパスを取得す。
戻り値
コンストラクタで設定されたふたつめのパスを返す。パスが設定されなかった場合は、空のパスを返す。
例
#include <iostream> #include <filesystem> namespace fs = std::filesystem; int main() { try { throw fs::filesystem_error( "can't copy file. source file doesn't found", "a/from.txt", "b/to.txt", std::make_error_code(std::errc::no_such_file_or_directory) ); } catch (fs::filesystem_error& err) { std::cout << err.path1() << std::endl; std::cout << err.path2() << std::endl; } }
出力
"a/from.txt"
"b/to.txt"
バージョン
言語
- C++17
処理系
- Clang:
- GCC, C++17 mode: 8.1
- Visual C++: