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

98 lines
6.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::basic_filebuf&lt;CharT,Traits&gt;::basic_filebuf</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_io_basic_filebuf_basic_filebuf 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::basic_filebuf&lt;CharT,Traits&gt;::</span>basic_filebuf</h1>
<div id="bodyContent">
<div id="contentSub"><span class="subpages">&lt; <a href="cpp.html">cpp</a>&lrm; | <a href="cpp-io.html">io</a>&lrm; | <a href="cpp-io-basic_filebuf.html">basic filebuf</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">
<td>
<div><span class="mw-geshi cpp source-cpp">basic_filebuf<span class="br0">(</span><span class="br0">)</span><span class="sy4">;</span></span></div>
</td>
<td>(1)</td>
<td class="t-dcl-nopad"></td>
</tr>
<tr class="t-dcl t-since-cxx11">
<td>
<div><span class="mw-geshi cpp source-cpp">basic_filebuf<span class="br0">(</span> <span class="kw4">const</span> <a href="cpp-io-basic_filebuf.html"><span class="kw1667">std::<span class="me2">basic_filebuf</span></span></a><span class="sy3">&amp;</span> rhs <span class="br0">)</span> <span class="sy1">=</span> delete<span class="sy4">;</span></span></div>
</td>
<td>(2)</td>
<td><span class="t-mark-rev t-since-cxx11">(C++11 &#36215;)</span></td>
</tr>
<tr class="t-dcl t-since-cxx11">
<td>
<div><span class="mw-geshi cpp source-cpp">basic_filebuf<span class="br0">(</span> <a href="cpp-io-basic_filebuf.html"><span class="kw1667">std::<span class="me2">basic_filebuf</span></span></a><span class="sy3">&amp;&amp;</span> rhs <span class="br0">)</span><span class="sy4">;</span></span></div>
</td>
<td>(3)</td>
<td><span class="t-mark-rev t-since-cxx11">(C++11 &#36215;)</span></td>
</tr>
<tr class="t-dcl-sep">
<td></td>
<td></td>
<td></td>
</tr>
</tbody>
</table>
<p>&#26500;&#36896;&#26032;&#30340; <code>std::basic_filebuf</code> &#23545;&#35937;&#12290;</p>
<div class="t-li1"><span class="t-li">1)</span> &#26500;&#36896; <code>std::basic_filebuf</code> &#23545;&#35937;&#65292;&#20197;&#35843;&#29992; <span class="t-lc"><a href="cpp-io-basic_streambuf.html">std::basic_streambuf</a></span> &#30340;&#40664;&#35748;&#26500;&#36896;&#20989;&#25968;&#21021;&#22987;&#21270;&#22522;&#31867;&#12290;&#21019;&#24314;&#30340; <code>basic_filebuf</code> &#19981;&#19982;&#25991;&#20214;&#20851;&#32852;&#65292;&#32780; <span class="t-lc"><a href="cpp-io-basic_filebuf-is_open.html">is_open()</a></span> &#36820;&#22238; <span class="t-c"><span class="mw-geshi cpp source-cpp"><span class="kw2">false</span></span></span> &#12290;</div>
<div class="t-li1"><span class="t-li">2)</span> &#22797;&#21046;&#26500;&#36896;&#20989;&#25968;&#34987;&#21024;&#38500;&#65307; <code>std::basic_filebuf</code> &#38750;<a href="cpp-named_req-CopyConstructible.html"><span style="font-style:italic">&#21487;&#22797;&#21046;&#26500;&#36896;</span> <span style="font-family: Georgia, &#39;DejaVu Serif&#39;, serif; font-style:italic">(CopyConstructible)</span></a> &#12290;</div>
<div class="t-li1"><span class="t-li">3)</span> &#36890;&#36807;&#20174;&#21478;&#19968; <code>std::basic_filebuf</code> &#23545;&#35937; <code>rhs</code> &#31227;&#21160;&#25152;&#26377;&#20869;&#23481;&#65292;&#21253;&#21547;&#32531;&#20914;&#21306;&#12289;&#20851;&#32852;&#30340;&#25991;&#20214;&#12289; locale &#12289;&#25171;&#24320;&#27169;&#24335;&#12289; is_open &#21464;&#37327;&#21644;&#25152;&#26377;&#20854;&#20182;&#29366;&#24577;&#31227;&#21160;&#26500;&#36896; <code>std::basic_filebuf</code> &#23545;&#35937;&#12290;&#31227;&#21160;&#21518;&#65292; <code>rhs</code> &#19981;&#19982;&#25991;&#20214;&#20851;&#32852;&#19988; <span class="t-c"><span class="mw-geshi cpp source-cpp">rhs.<span class="me1">is_open</span><span class="br0">(</span><span class="br0">)</span><span class="sy1">==</span><span class="kw2">false</span></span></span> &#12290;&#20445;&#35777; <code>rhs</code> &#30340;&#22522;&#31867;&#21644; <code>*this</code> &#30340;&#22522;&#31867; <span class="t-lc"><a href="cpp-io-basic_streambuf.html">std::basic_streambuf</a></span> &#30340;&#25104;&#21592;&#25351;&#38024;&#25351;&#21521;&#19981;&#21516;&#32531;&#20914;&#21306;&#65292;&#38500;&#38750;&#23427;&#20204;&#20026;&#31354;&#12290;</div>
<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>rhs</td>
<td>-</td>
<td>&#21478;&#19968; <code>basic_filebuf</code></td>
</tr>
</table>
<h3><span class="mw-headline" id=".E6.B3.A8.E6.84.8F">&#27880;&#24847;</span></h3>
<p>&#20856;&#22411;&#22320;&#20026; <span class="t-lc"><a href="cpp-io-basic_fstream.html">std::basic_fstream</a></span> &#30340;&#26500;&#36896;&#20989;&#25968;&#25152;&#35843;&#29992;&#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-io-basic_filebuf-operator=.html"><span class="t-lines"><span>operator=</span></span></a></div>
<div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx11">(C++11)</span></span></span></div>
</div>
</td>
<td>&#36171;&#20540; basic_filebuf &#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 t-dsc-member-nobold-div">
<div><a href="cpp-io-basic_filebuf-~basic_filebuf.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; basic_filebuf &#23545;&#35937;&#24182;&#19988;&#33509;&#25171;&#24320;&#21017;&#20851;&#38381;&#25991;&#20214;<br />
<span class="t-mark">(&#34394;&#20844;&#24320;&#25104;&#21592;&#20989;&#25968;)</span></td>
</tr>
</table>
</div>
<div class="visualClear"></div>
</div>
</div>
</div>
</body>
</html>