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

78 lines
5.7 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::directory_entry::assign</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_directory_entry_assign 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::directory_entry::</span>assign</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>&lrm; | <a href="cpp-filesystem-directory_entry.html">directory entry</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-dcl t-since-cxx17">
<td>
<div><span class="mw-geshi cpp source-cpp"><span class="kw4">void</span> assign<span class="br0">(</span> <span class="kw4">const</span> <a href="cpp-filesystem-path.html"><span class="kw2199">std::<span class="me2">filesystem</span><span class="sy4">::</span><span class="me2">path</span></span></a><span class="sy3">&amp;</span> p <span class="br0">)</span><span class="sy4">;</span><br />
<span class="kw4">void</span> assign<span class="br0">(</span> <span class="kw4">const</span> <a href="cpp-filesystem-path.html"><span class="kw2199">std::<span class="me2">filesystem</span><span class="sy4">::</span><span class="me2">path</span></span></a><span class="sy3">&amp;</span> p, <a href="cpp-error-error_code.html"><span class="kw877">std::<span class="me2">error_code</span></span></a><span class="sy3">&amp;</span> ec <span class="br0">)</span><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>&#22797;&#21046;&#26032;&#30340;&#20869;&#23481;&#21040; directory_entry &#23545;&#35937;&#12290;&#35774;&#32622;&#21040; <code>p</code> &#30340;&#36335;&#24452;&#24182;&#35843;&#29992; <a href="cpp-filesystem-directory_entry-refresh.html"><tt>refresh</tt></a> &#26356;&#26032;&#32531;&#23384;&#30340;&#23646;&#24615;&#12290;&#33509;&#21457;&#29983;&#38169;&#35823;&#65292;&#21017;&#32531;&#23384;&#23646;&#24615;&#30340;&#20540;&#26159;&#26410;&#25351;&#23450;&#30340;&#12290;</p>
<h3><span class="mw-headline" id=".E5.8F.82.E6.95.B0">&#21442;&#25968;</span></h3>
<table class="t-par-begin">
<tr class="t-par">
<td>p</td>
<td>-</td>
<td>directory_entry &#23558;&#25351;&#20195;&#30340;&#25991;&#20214;&#31995;&#32479;&#23545;&#35937;&#30340;&#36335;&#24452;</td>
</tr>
<tr class="t-par">
<td>ec</td>
<td>-</td>
<td>&#19981;&#25243;&#20986;&#37325;&#36733;&#20013;&#25253;&#21578;&#38169;&#35823;&#30340;&#36755;&#20986;&#21442;&#25968;</td>
</tr>
</table>
<h3><span class="mw-headline" id=".E8.BF.94.E5.9B.9E.E5.80.BC">&#36820;&#22238;&#20540;</span></h3>
<p>&#65288;&#26080;&#65289;</p>
<h3><span class="mw-headline" id=".E5.BC.82.E5.B8.B8">&#24322;&#24120;</span></h3>
<p>&#19981;&#25509;&#21463; <span class="t-c"><span class="mw-geshi cpp source-cpp"><a href="cpp-error-error_code.html"><span class="kw877">std::<span class="me2">error_code</span></span></a><span class="sy3">&amp;</span></span></span> &#21442;&#25968;&#30340;&#37325;&#36733;&#22312;&#24213;&#23618; OS API &#38169;&#35823;&#26102;&#25243;&#20986; <a href="cpp-filesystem-filesystem_error.html"><tt>filesystem_error</tt></a> &#65292;&#20197;&#31532;&#19968; path &#21442;&#25968; <code>p</code> &#21644;&#20316;&#20026;&#38169;&#35823;&#30721;&#21442;&#25968;&#30340; OS &#38169;&#35823;&#30721;&#26500;&#36896;&#12290;&#33509; OS API &#35843;&#29992;&#22833;&#36133;&#65292;&#21017;&#25509;&#21463; <span class="t-c"><span class="mw-geshi cpp source-cpp"><a href="cpp-error-error_code.html"><span class="kw877">std::<span class="me2">error_code</span></span></a><span class="sy3">&amp;</span></span></span> &#21442;&#25968;&#30340;&#37325;&#36733;&#35774;&#32622;&#35813;&#21442;&#25968;&#20026; OS API &#38169;&#35823;&#30721;&#65292;&#32780;&#33509;&#19981;&#20986;&#29616;&#38169;&#35823;&#21017;&#25191;&#34892; <span class="t-c"><span class="mw-geshi cpp source-cpp">ec.<span class="me1">clear</span><span class="br0">(</span><span class="br0">)</span></span></span> &#12290;&#33509;&#20869;&#23384;&#20998;&#37197;&#22833;&#36133;&#65292;&#21017;&#20219;&#20309;&#19981;&#26631;&#35760;&#20026; <code>noexcept</code> &#30340;&#37325;&#36733;&#21487;&#33021;&#25243;&#20986; <span class="t-lc"><a href="cpp-memory-new-bad_alloc.html">std::bad_alloc</a></span> &#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>
<h3><span class="mw-headline" id=".E5.8F.82.E9.98.85">&#21442;&#38405;</span></h3>
<table class="t-dsc-begin">
<tr class="t-dsc">
<td>
<div class="t-dsc-member-div">
<div><a href="cpp-filesystem-directory_entry-operator=.html"><span class="t-lines"><span>operator=</span></span></a></div>
</div>
</td>
<td>&#36171;&#20540;&#20869;&#23481;<br />
<span class="t-mark">(&#20844;&#24320;&#25104;&#21592;&#20989;&#25968;)</span></td>
</tr>
</table>
</div>
<div class="visualClear"></div>
</div>
</div>
</div>
</body>
</html>