Files
hustoj/web/cppreference-zh/chmhelp/cpp-filesystem-filesystem_error.html
2025-08-01 12:57:54 +08:00

163 lines
8.9 KiB
HTML

<!DOCTYPE html>
<html lang="zh" dir="ltr" class="client-nojs" xmlns="http://www.w3.org/1999/xhtml" xml:lang="zh">
<head><meta http-equiv="x-ua-compatible" content="ie=edge">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>std::filesystem::filesystem_error</title>
<link rel="stylesheet" href="ext.css" />
<link rel="stylesheet" href="site_modules.css" />
</head>
<body class="mediawiki ltr sitedir-ltr ns-0 ns-subject page-cpp_filesystem_filesystem_error skin-cppreference2 action-view cpp-navbar">
<div id="cpp-content-base">
<div id="content"><a id="top"></a>
<h1 id="firstHeading" class="firstHeading"><span style="font-size:0.7em; line-height:130%">std::filesystem::</span>filesystem_error</h1>
<div id="bodyContent">
<div id="contentSub"><span class="subpages">&lt; <a href="cpp.html">cpp</a>&lrm; | <a href="cpp-filesystem.html">filesystem</a></span></div>
<div id="mw-content-text" lang="zh" dir="ltr" class="mw-content-ltr" xml:lang="zh">
<table class="t-dcl-begin">
<tbody>
<tr class="t-dsc-header">
<td>
<div>&#23450;&#20041;&#20110;&#22836;&#25991;&#20214; <code><a href="cpp-header-filesystem.html">&lt;filesystem&gt;</a></code></div>
</td>
<td></td>
<td></td>
</tr>
<tr class="t-dcl t-since-cxx17">
<td>
<div><span class="mw-geshi cpp source-cpp"><span class="kw1">class</span> filesystem_error<span class="sy4">;</span></span></div>
</td>
<td class="t-dcl-nopad"></td>
<td><span class="t-mark-rev t-since-cxx17">(C++17 &#36215;)</span></td>
</tr>
<tr class="t-dcl-sep">
<td></td>
<td></td>
<td></td>
</tr>
</tbody>
</table>
<p>&#31867; <code>std::filesystem::filesystem_error</code> &#23450;&#20041;&#25991;&#20214;&#31995;&#32479;&#24211;&#20013;&#20989;&#25968;&#30340;&#25243;&#20986;&#29256;&#37325;&#36733;&#25152;&#25243;&#20986;&#30340;&#24322;&#24120;&#23545;&#35937;&#12290;</p>
<div class="t-inheritance-diagram">
<div class="center">
<div class="noresize" style="height: 40px; width: 513px;"><map name="ImageMap_1_316919110" id="ImageMap_1_316919110">
<area href="cpp-error-exception.html" shape="rect" coords="4,4,107,36" alt="cpp/error/exception" />
<area href="cpp-error-runtime_error.html" shape="rect" coords="134,4,237,36" alt="cpp/error/runtime error" />
<area href="cpp-error-system_error.html" shape="rect" coords="264,4,367,36" alt="cpp/error/system error" /></map><img alt="std-filesystem-filesystem error-inheritance.svg" src="std-filesystem-filesystem_error-inheritance.svg" width="513" height="40" usemap="#ImageMap_1_316919110" /></div>
</div>
<div style="text-align:center;">
<p><span style="font-size:0.7em; line-height:130%">&#32487;&#25215;&#22270;</span></p>
</div>
</div>
<h3><span class="mw-headline" id=".E6.88.90.E5.91.98.E5.87.BD.E6.95.B0">&#25104;&#21592;&#20989;&#25968;</span></h3>
<table class="t-dsc-begin">
<tr class="t-dsc">
<td>
<div class="t-dsc-member-div t-dsc-member-nobold-div">
<div><a href="cpp-filesystem-filesystem_error-filesystem_error.html"><span class="t-lines"><span>(&#26500;&#36896;&#20989;&#25968;)</span></span></a></div>
</div>
</td>
<td>&#26500;&#36896;&#24322;&#24120;&#23545;&#35937;<br />
<span class="t-mark">(&#20844;&#24320;&#25104;&#21592;&#20989;&#25968;)</span></td>
</tr>
<tr class="t-dsc">
<td>
<div class="t-dsc-member-div">
<div><a href="https://zh.cppreference.com/w/cpp/filesystem/filesystem_error/operator%3D" title="cpp/filesystem/filesystem error/operator="><span class="t-lines"><span>operator=</span></span></a></div>
</div>
</td>
<td>&#26367;&#25442;&#24322;&#24120;&#23545;&#35937;<br />
<span class="t-mark">(&#20844;&#24320;&#25104;&#21592;&#20989;&#25968;)</span></td>
</tr>
<tr class="t-dsc">
<td>
<div class="t-dsc-member-div">
<div><a href="cpp-filesystem-filesystem_error-path.html"><span class="t-lines"><span>path1</span><span>path2</span></span></a></div>
</div>
</td>
<td>&#36820;&#22238;&#23548;&#33268;&#38169;&#35823;&#30340;&#25805;&#20316;&#25152;&#28041;&#21450;&#30340;&#36335;&#24452;<br />
<span class="t-mark">(&#20844;&#24320;&#25104;&#21592;&#20989;&#25968;)</span></td>
</tr>
<tr class="t-dsc">
<td>
<div class="t-dsc-member-div">
<div><a href="cpp-filesystem-filesystem_error-what.html"><span class="t-lines"><span>what</span></span></a></div>
</div>
</td>
<td>&#36820;&#22238;&#35299;&#37322;&#24615;&#23383;&#31526;&#20018;<br />
<span class="t-mark">(&#20844;&#24320;&#25104;&#21592;&#20989;&#25968;)</span></td>
</tr>
</table>
<div class="t-inherited">
<h2><span class="mw-headline" id=".E7.BB.A7.E6.89.BF.E8.87.AA_std::system_error">&#32487;&#25215;&#33258; <a href="cpp-error-system_error.html"><span style="font-size:0.7em; line-height:130%">std::</span>system_error</a></span></h2>
<h3><span class="mw-headline" id=".E6.88.90.E5.91.98.E5.87.BD.E6.95.B0_2">&#25104;&#21592;&#20989;&#25968;</span></h3>
<table class="t-dsc-begin">
<tr class="t-dsc">
<td>
<div class="t-dsc-member-div">
<div><a href="cpp-error-system_error-code.html"><span class="t-lines"><span>code</span></span></a></div>
</div>
</td>
<td>&#36820;&#22238;&#38169;&#35823;&#30721;<br />
<span class="t-mark">(<code>std::system_error</code> &#30340;&#20844;&#24320;&#25104;&#21592;&#20989;&#25968;)</span></td>
</tr>
<tr class="t-dsc">
<td>
<div class="t-dsc-member-div">
<div><a href="cpp-error-system_error-what.html"><span class="t-lines"><span>what</span></span></a></div>
<div><span class="t-lines"><span><span class="t-cmark">[&#34394;]</span></span></span></div>
</div>
</td>
<td>&#36820;&#22238;&#35299;&#37322;&#24615;&#23383;&#31526;&#20018;<br />
<span class="t-mark">(<code>std::system_error</code> &#30340;&#34394;&#20844;&#24320;&#25104;&#21592;&#20989;&#25968;)</span></td>
</tr>
</table>
</div>
<div class="t-inherited">
<h2><span class="mw-headline" id=".E7.BB.A7.E6.89.BF.E8.87.AA_std::runtime_error">&#32487;&#25215;&#33258; <a href="cpp-error-runtime_error.html"><span style="font-size:0.7em; line-height:130%">std::</span>runtime_error</a></span></h2>
<p><br /></p>
</div>
<div class="t-inherited">
<h2><span class="mw-headline" id=".E7.BB.A7.E6.89.BF.E8.87.AA_std::exception">&#32487;&#25215;&#33258; <a href="cpp-error-exception.html"><span style="font-size:0.7em; line-height:130%">std::</span>exception</a></span></h2>
<h3><span class="mw-headline" id=".E6.88.90.E5.91.98.E5.87.BD.E6.95.B0_3">&#25104;&#21592;&#20989;&#25968;</span></h3>
<table class="t-dsc-begin">
<tr class="t-dsc">
<td>
<div class="t-dsc-member-div t-dsc-member-nobold-div">
<div><a href="cpp-error-exception-~exception.html"><span class="t-lines"><span>(&#26512;&#26500;&#20989;&#25968;)</span></span></a></div>
<div><span class="t-lines"><span><span class="t-cmark">[&#34394;]</span></span></span></div>
</div>
</td>
<td>&#26512;&#26500;&#35813;&#24322;&#24120;&#23545;&#35937;<br />
<span class="t-mark">(<code>std::exception</code> &#30340;&#34394;&#20844;&#24320;&#25104;&#21592;&#20989;&#25968;)</span></td>
</tr>
<tr class="t-dsc">
<td>
<div class="t-dsc-member-div">
<div><a href="cpp-error-exception-what.html"><span class="t-lines"><span>what</span></span></a></div>
<div><span class="t-lines"><span><span class="t-cmark">[&#34394;]</span></span></span></div>
</div>
</td>
<td>&#36820;&#22238;&#35299;&#37322;&#24615;&#23383;&#31526;&#20018;<br />
<span class="t-mark">(<code>std::exception</code> &#30340;&#34394;&#20844;&#24320;&#25104;&#21592;&#20989;&#25968;)</span></td>
</tr>
</table>
</div>
<h3><span class="mw-headline" id=".E6.B3.A8.E8.A7.A3">&#27880;&#35299;</span></h3>
<p>&#20026;&#30830;&#20445; <code>filesystem_error</code> &#30340;&#22797;&#21046;&#20989;&#25968;&#20026; noexcept &#65292;&#20856;&#22411;&#23454;&#29616;&#23558;&#20445;&#26377; <span class="t-lc"><a href="cpp-filesystem-filesystem_error-what.html">what()</a></span> &#30340;&#36820;&#22238;&#20540;&#30340;&#23545;&#35937;&#21644; <span class="t-lc"><a href="cpp-filesystem-filesystem_error-path.html">path1()</a></span> &#19982; <span class="t-lc"><a href="cpp-filesystem-filesystem_error-path.html">path2()</a></span> &#25152;&#20998;&#21035;&#24341;&#29992;&#30340;&#20108;&#20010; <span class="t-lc"><a href="cpp-filesystem-path.html">std::filesystem::path</a></span> &#23545;&#35937;&#23384;&#20648;&#20110;&#20998;&#31163;&#20998;&#37197;&#30340;&#24341;&#29992;&#35745;&#25968;&#23384;&#20648;&#12290;</p>
<p>&#24403;&#21069; <a rel="nofollow" class="external text" href="https://github.com/microsoft/STL/blob/master/stl/inc/filesystem#L1749">MS STL &#23454;&#29616;</a>&#19981;&#21512;&#26631;&#20934;&#65306;&#19978;&#36848;&#23545;&#35937;&#34987;&#30452;&#25509;&#23384;&#20648;&#22312; <code>filesystem</code> &#23545;&#35937;&#20013;&#65292;&#36825;&#20351;&#24471;&#22797;&#21046;&#20989;&#25968;&#19981;&#26159; noexcept &#12290;</p>
<h3><span class="mw-headline" id=".E7.A4.BA.E4.BE.8B">&#31034;&#20363;</span></h3>
<table class="metadata plainlinks ambox mbox-small-left ambox-notice" style="">
<tr>
<td class="mbox-empty-cell"></td>
<td class="mbox-text" style="">&#26412;&#33410;&#26410;&#23436;&#25104;<br />
&#21407;&#22240;&#65306;&#26242;&#26080;&#31034;&#20363;</td>
</tr>
</table>
</div>
<div class="visualClear"></div>
</div>
</div>
</div>
</body>
</html>