{"id":185,"date":"2021-11-21T13:01:57","date_gmt":"2021-11-21T13:01:57","guid":{"rendered":"http:\/\/47.103.123.166\/?p=185"},"modified":"2021-11-21T13:24:19","modified_gmt":"2021-11-21T13:24:19","slug":"c_9-%e6%96%87%e4%bb%b6%e8%af%bb%e5%86%99%e8%be%93%e5%85%a5%e8%be%93%e5%87%ba%e6%b5%81","status":"publish","type":"post","link":"http:\/\/47.103.123.166\/?p=185","title":{"rendered":"C++_9\u2014\u2014\u6587\u4ef6\u8bfb\u5199&#038;\u8f93\u5165\u8f93\u51fa\u6d41"},"content":{"rendered":"<p><font face=\"\u6977\u4f53\">&emsp;&emsp;\u8fd9\u4e00\u7cfb\u5217\u6587\u7ae0\u7684\u76ee\u7684\u662f\u5728\u5b66\u4e60\u4e86C++\u57fa\u7840\u540e\uff0c\u7ee7\u7eed\u8865\u5145\u4e00\u4e9bC++\u57fa\u7840\u548c\u8fdb\u9636\u7684\u77e5\u8bc6\u70b9\uff0c\u5305\u62ecC++11\u7684\u76f8\u5173\u5185\u5bb9\u3002<br \/>\n\u4ee5C++11\u6807\u51c6\u4e3a\u57fa\u7840\u3002<\/p>\n<h3>\u7ee7\u627f\u5173\u7cfb<\/h3>\n<table>\n<thead>\n<tr>\n<th>parent<\/th>\n<th>c1<\/th>\n<th>c2<\/th>\n<th>c3<\/th>\n<th>c4<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>ios_base<\/td>\n<td>ios<\/td>\n<td>istream<\/td>\n<td>iostream<\/td>\n<td>fstream<\/td>\n<td><\/td>\n<td><\/td>\n<td><\/td>\n<td><\/td>\n<td><\/td>\n<td><\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td><\/td>\n<td><\/td>\n<td><\/td>\n<td><\/td>\n<td>stringstream<\/td>\n<td><\/td>\n<td><\/td>\n<td><\/td>\n<td><\/td>\n<td><\/td>\n<td><\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td><\/td>\n<td><\/td>\n<td><\/td>\n<td>ifstream<\/td>\n<td><\/td>\n<td><\/td>\n<td><\/td>\n<td><\/td>\n<td><\/td>\n<td><\/td>\n<td><\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td><\/td>\n<td><\/td>\n<td><\/td>\n<td>istringstream<\/td>\n<td><\/td>\n<td><\/td>\n<td><\/td>\n<td><\/td>\n<td><\/td>\n<td><\/td>\n<td><\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td><\/td>\n<td><\/td>\n<td>ostream<\/td>\n<td>ofstream<\/td>\n<td><\/td>\n<td><\/td>\n<td><\/td>\n<td><\/td>\n<td><\/td>\n<td><\/td>\n<td><\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td><\/td>\n<td><\/td>\n<td><\/td>\n<td>ostringstream<\/td>\n<td><\/td>\n<td><\/td>\n<td><\/td>\n<td><\/td>\n<td><\/td>\n<td><\/td>\n<td><\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td>streambuf<\/td>\n<td>filebuf<\/td>\n<td><\/td>\n<td><\/td>\n<td><\/td>\n<td><\/td>\n<td><\/td>\n<td><\/td>\n<td><\/td>\n<td><\/td>\n<td><\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td><\/td>\n<td>stringbuf<\/td>\n<td><\/td>\n<td><\/td>\n<td><\/td>\n<td><\/td>\n<td><\/td>\n<td><\/td>\n<td><\/td>\n<td><\/td>\n<td><\/td>\n<td><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3>C++\u6587\u4ef6\u8bfb\u5199<\/h3>\n<h4>\u6587\u4ef6\u8bfb\u5199\u7684\u7c7b<\/h4>\n<table>\n<thead>\n<tr>\n<th>Narrow characters (char)<\/th>\n<th>Wide characters (wchar_t)<\/th>\n<th><\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>ifstream<\/td>\n<td>wifstream<\/td>\n<td>Input file stream class (class )<\/td>\n<\/tr>\n<tr>\n<td>ofstream<\/td>\n<td>wofstream<\/td>\n<td>Output file stream (class )<\/td>\n<\/tr>\n<tr>\n<td>fstream<\/td>\n<td>wfstream<\/td>\n<td>Input\/output file stream class (class )<\/td>\n<\/tr>\n<tr>\n<td>filebuf<\/td>\n<td>wfilebuf<\/td>\n<td>File stream buffer (class )<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<ol>\n<li>\u7c7b<strong>ofstream<\/strong>, <strong>ifstream<\/strong> \u548c<strong>fstream<\/strong> \u662f\u5206\u522b\u7ee7\u627f\u81ea<strong>ostream<\/strong>, <strong>istream<\/strong> \u548c<strong>iostream<\/strong> \uff0c\u56e0\u800c\u50cf\u6253\u5f00\u6587\u4ef6\u7684\u6a21\u5f0f\u3001\u8bfb\u5199\u6570\u636e\u7684\u65b9\u5f0f\u7b49\uff0c\u90fd\u53ef\u4ee5\u4f7f\u7528\u7236\u7c7b\u7684\u6210\u5458\u548c\u6210\u5458\u51fd\u6570\u3002<\/li>\n<li>\u7c7b<strong>ofstream<\/strong>, <strong>ifstream<\/strong> \u548c<strong>fstream<\/strong> \u5185\u90e8\u7ef4\u62a4\u4e00\u4e2a<strong>filebuf<\/strong>\u5bf9\u8c61\uff0c\u4f5c\u4e3a\u5185\u90e8\u6d41\u7f13\u51b2\u533a\uff0c\u5bf9\u5173\u8054\u6587\u4ef6\u6267\u884c\u8f93\u5165\u8f93\u51fa\u64cd\u4f5c\u3002\u8fd9\u4e5f\u5bf9\u5e94\u7740<strong>ostream<\/strong>, <strong>istream<\/strong> \u548c<strong>iostream<\/strong>\u5185\u90e8\u7ef4\u62a4\u7684<strong>streambuf<\/strong>\u5bf9\u8c61\u3002<\/li>\n<\/ol>\n<h4>\u5f00\u95ed\u6587\u4ef6<\/h4>\n<p>\u7c7b<strong>ofstream<\/strong>, <strong>ifstream<\/strong> \u548c<strong>fstream<\/strong> \u57fa\u672c\u4e00\u81f4\uff0c\u4ee5<strong>ifstream<\/strong>\u4e3a\u4f8b<\/p>\n<ol>\n<li>\u5173\u8054\u4e0e\u5173\u95ed\u6587\u4ef6\n<pre><code class=\"language-cpp\">#include &lt;fstream&gt; \n\/\/ \u65b9\u6cd5\u4e00\uff1a\u6784\u9020   \nifstream(); \nexplicit ifstream (const char* filename, ios_base::openmode mode = ios_base::in);\nexplicit ifstream (const string&amp; filename, ios_base::openmode mode = ios_base::in);\n\/\/ e.g.\nstd::ifstream ifs (\"test.txt\", std::ifstream::in);\n\/\/ \u65b9\u6cd5\u4e8c\uff1a\u6210\u5458\u51fd\u6570 open\nvoid open (const   char* filename,  ios_base::openmode mode = ios_base::in);\nvoid open (const string&amp; filename,  ios_base::openmode mode = ios_base::in);\n\/\/ e.g.\nstd::ifstream ifs;\nifs.open (\"test.txt\", std::ifstream::in);\n\/\/ \u5173\u95ed\u6587\u4ef6\nvoid close();<\/code><\/pre>\n<\/li>\n<li>\u6587\u4ef6\u6253\u5f00\u7c7b\u578b\n<pre><code class=\"language-cpp\">\/\/ \u6ce8\uff1a\u6839\u636e\u7ee7\u627f\u5173\u7cfb\uff0c\u6b64\u6210\u5458\u53d8\u91cf\u90fd\u80fd\u7528\nstd::ifstream::in   \nstd::ios_base::in<\/code><\/pre>\n<\/li>\n<\/ol>\n<table>\n<thead>\n<tr>\n<th>\u7c7b\u578b<\/th>\n<th>\u8bf4\u660e<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>in<\/td>\n<td>File open for reading\uff0c\u5bf9\u4e8eifstream\u5fc5\u6709<\/td>\n<\/tr>\n<tr>\n<td>out<\/td>\n<td>File open for writing\uff0c\u5185\u90e8\u7684filebuf\u4e5f\u53ef\u8bbe\u7f6e\u4e3a\u8f93\u51fa\u6a21\u5f0f<\/td>\n<\/tr>\n<tr>\n<td>binary<\/td>\n<td>\u4ee5\u4e8c\u8fdb\u5236\u65b9\u5f0f\u6253\u5f00<\/td>\n<\/tr>\n<tr>\n<td>app<\/td>\n<td>\u4ece\u6587\u4ef6\u5c3e\u5f00\u59cb\u5199<\/td>\n<\/tr>\n<tr>\n<td>ate<\/td>\n<td>\u4ece\u6587\u4ef6\u5c3e\u5f00\u59cb\u8bfb<\/td>\n<\/tr>\n<tr>\n<td>trunc<\/td>\n<td>\u5982\u679c\u6587\u4ef6\u5df2\u5b58\u5728\uff0c\u5219\u5148\u5220\u9664\u6587\u4ef6<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<ol>\n<li>\u68c0\u67e5\u6253\u5f00\u60c5\u51b5<\/li>\n<\/ol>\n<pre><code class=\"language-cpp\">    bool is_open() const;<\/code><\/pre>\n<h4>\u8bfb\u5199\u6587\u4ef6<\/h4>\n<ol>\n<li>\n<p>\u8bfb\u5199\u6587\u4ef6<\/p>\n<pre><code class=\"language-cpp\">\/\/ get()\n\/\/ single character\n    int get();\n    istream&amp; get (char&amp; c);\n\/\/ c-string\n    istream&amp; get (char* s, streamsize n);\n    istream&amp; get (char* s, streamsize n, char delim);\n\/\/ stream buffer\n    istream&amp; get (streambuf&amp; sb);\n    istream&amp; get (streambuf&amp; sb, char delim);\n\/\/ getline()\nistream&amp; getline (char* s, streamsize n );\nistream&amp; getline (char* s, streamsize n, char delim );\n\/\/ operator (&gt;&gt;) \u4e0d\u518d\u8d58\u8ff0\n\/\/ read &amp; write\n\/\/ Extracts n characters from the stream and stores them in the array pointed to by s.\n    istream&amp; read (char* s, streamsize n);          \n\/\/ Inserts the first n characters of the array pointed by s into the stream.\n    ostream&amp; write (const char* s, streamsize n);   <\/code><\/pre>\n<\/li>\n<li>\u83b7\u53d6\u548c\u8bbe\u7f6e\u6d41\u6307\u9488\n<pre><code class=\"language-cpp\">\/\/ \u83b7\u53d6\u5f53\u524d\u6d41\u6307\u9488\u4f4d\u7f6e\nstreampos tellg();  \/\/ \u8bfb\u64cd\u4f5c\u65f6\uff0c\u6d41\u6307\u9488\u5f53\u524d\u4f4d\u7f6e\uff0c\u8fd4\u56de\u503c\u662f\u4e00\u4e2a\u6574\u6570\nstreampos tellp();  \/\/ \u5199\u64cd\u4f5c\u65f6\uff0c\u6d41\u6307\u9488\u5f53\u524d\u4f4d\u7f6e\n\/\/ \u8bbe\u7f6e\u6d41\u6307\u9488\u4f4d\u7f6e\nistream&amp; seekg (streampos pos);                         \/\/ \u7ed9\u5b9a\u4ece\u6587\u4ef6\u5f00\u59cb\u7684\u7edd\u5bf9\u4f4d\u7f6e\nistream&amp; seekg (streamoff off, ios_base::seekdir way);  \/\/ \u7ed9\u5b9a\u4eceway\u5f00\u59cb\u504f\u79fboff\u7684\u4f4d\u7f6e\nostream&amp; seekp (streampos pos);\nostream&amp; seekp (streamoff off, ios_base::seekdir way);<\/code><\/pre>\n<\/li>\n<\/ol>\n<table>\n<thead>\n<tr>\n<th>ios_base::seekdir\u53d6\u503c<\/th>\n<th>\u8bf4\u660e<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>ios_base::beg<\/td>\n<td>beginning of the stream<\/td>\n<\/tr>\n<tr>\n<td>ios_base::cur<\/td>\n<td>current position in the stream<\/td>\n<\/tr>\n<tr>\n<td>ios_base::end<\/td>\n<td>end of the stream<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<ol>\n<li>\u72b6\u6001\u6807\u5fd7\u51fd\u6570\n<pre><code class=\"language-cpp\">\/\/ Check whether eofbit is set  \n\/\/ \u6587\u4ef6\u8bfb\u5230\u672b\u5c3e\u65f6\uff0ceofbit\u4f1a\u7f6e\u4f4d\uff0c\u5bf9\u5e94\u8fd4\u56detrue\nbool eof() const;   \n\/\/ Check whether badbit is set  \n\/\/ \u5982\u679c\u5728\u8bfb\u5199\u8fc7\u7a0b\u4e2d\u51fa\u9519\uff0c\u8fd4\u56de true \u3002\u4f8b\u5982\uff1a\u5f53\u6211\u4eec\u8981\u5bf9\u4e00\u4e2a\u4e0d\u662f\u6253\u5f00\u4e3a\u5199\u72b6\u6001\u7684\u6587\u4ef6\u8fdb\u884c\u5199\u5165\u65f6\uff0c\u6216\u8005\u6211\u4eec\u8981\u5199\u5165\u7684\u8bbe\u5907\u6ca1\u6709\u5269\u4f59\u7a7a\u95f4\u7684\u65f6\u5019\u3002\nbool bad() const;   \n\/\/ Check whether either failbit or badbit is set    \n\/\/ \u9664\u4e86\u4e0ebad() \u540c\u6837\u7684\u60c5\u51b5\u4e0b\u4f1a\u8fd4\u56de true \u4ee5\u5916\uff0c\u52a0\u4e0a\u683c\u5f0f\u9519\u8bef\u65f6\u4e5f\u8fd4\u56detrue \uff0c\u4f8b\u5982\u5f53\u60f3\u8981\u8bfb\u5165\u4e00\u4e2a\u6574\u6570\uff0c\u800c\u83b7\u5f97\u4e86\u4e00\u4e2a\u5b57\u6bcd\u7684\u65f6\u5019\u3002\nbool fail() const;  \n\/\/ Check whether state of stream is good\n\/\/ \u4ee5\u4e0a\u4e09\u4e2a\u6807\u5fd7\u4f4d\uff08eofbit\/badbit\/failbit\uff09\u4efb\u4f55\u4e00\u4e2a\u4e3atrue\uff0c\u5219goodbit\u7f6e\u4e3a0\uff0c\u5bf9\u5e94\u8fd4\u56defalse\nbool good() const;<\/code><\/pre>\n<\/li>\n<\/ol>\n<table>\n<thead>\n<tr>\n<th>\u8bfb\u5199\u72b6\u6001\u6807\u5fd7\u4f4d<\/th>\n<th>\u610f\u4e49<\/th>\n<th>good()\u662f\u5426check<\/th>\n<th>eof()\u662f\u5426check<\/th>\n<th>fail()\u662f\u5426check<\/th>\n<th>bad()\u662f\u5426check<\/th>\n<th>rdstate()\u662f\u5426check<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>goodbit<\/td>\n<td>No errors (zero value iostate)<\/td>\n<td>true<\/td>\n<td>false<\/td>\n<td>false<\/td>\n<td>false<\/td>\n<td>goodbit<\/td>\n<\/tr>\n<tr>\n<td>eofbit<\/td>\n<td>End-of-File reached on input operation<\/td>\n<td>false<\/td>\n<td>true<\/td>\n<td>false<\/td>\n<td>false<\/td>\n<td>eofbit<\/td>\n<\/tr>\n<tr>\n<td>failbit<\/td>\n<td>Logical error on i\/o operation<\/td>\n<td>false<\/td>\n<td>false<\/td>\n<td>true<\/td>\n<td>false<\/td>\n<td>failbit<\/td>\n<\/tr>\n<tr>\n<td>badbit<\/td>\n<td>Read\/writing error on i\/o operation<\/td>\n<td>false<\/td>\n<td>false<\/td>\n<td>true<\/td>\n<td>true<\/td>\n<td>badbit<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h4>\u8bfb\u5199\u7f13\u51b2\u4e0e\u540c\u6b65<\/h4>\n<p>\uff08\u4e0b\u6b21\u4e00\u5b9a&#8230; \u5b9e\u9645\u4e0aifsream\u548cofstream\u90fd\u4f1a\u7ef4\u62a4\u4e00\u4e2afilebuf\u5bf9\u8c61\uff0c\u5176\u4e00\u4e9b\u6210\u5458\u51fd\u6570\u5185\u90e8\u90fd\u662f\u6267\u884c\u7684filebuf\u7684\u6210\u5458\u51fd\u6570\uff09<\/p>\n<p>\u4e0b\u9762\u662f\u4e00\u6bb5\u6458\u6284\uff1a<\/p>\n<blockquote>\n<p>\u5f53\u6211\u4eec\u5bf9\u6587\u4ef6\u6d41\u8fdb\u884c\u64cd\u4f5c\u7684\u65f6\u5019\uff0c\u5b83\u4eec\u4e0e\u4e00\u4e2astreambuf \u7c7b\u578b\u7684\u7f13\u5b58(buffer)\u8054\u7cfb\u5728\u4e00\u8d77\u3002\u8fd9\u4e2a\u7f13\u5b58\uff08buffer\uff09\u5b9e\u9645\u662f\u4e00\u5757\u5185\u5b58\u7a7a\u95f4\uff0c\u4f5c\u4e3a\u6d41(stream)\u548c\u7269\u7406\u6587\u4ef6\u7684\u5a92\u4ecb\u3002\u4f8b\u5982\uff0c\u5bf9\u4e8e\u4e00\u4e2a\u8f93\u51fa\u6d41\uff0c \u6bcf\u6b21\u6210\u5458\u51fd\u6570put (\u5199\u4e00\u4e2a\u5355\u4e2a\u5b57\u7b26)\u88ab\u8c03\u7528\uff0c\u8fd9\u4e2a\u5b57\u7b26\u4e0d\u662f\u76f4\u63a5\u88ab\u5199\u5165\u8be5\u8f93\u51fa\u6d41\u6240\u5bf9\u5e94\u7684\u7269\u7406\u6587\u4ef6\u4e2d\u7684\uff0c\u800c\u662f\u9996\u5148\u88ab\u63d2\u5165\u5230\u8be5\u6d41\u7684\u7f13\u5b58\uff08buffer\uff09\u4e2d\u3002<br \/>\n\u5f53\u7f13\u5b58\u88ab\u6392\u653e\u51fa\u6765(flush)\u65f6\uff0c\u5b83\u91cc\u9762\u7684\u6240\u6709\u6570\u636e\u6216\u8005\u88ab\u5199\u5165\u7269\u7406\u5a92\u8d28\u4e2d\uff08\u5982\u679c\u662f\u4e00\u4e2a\u8f93\u51fa\u6d41\u7684\u8bdd\uff09\uff0c\u6216\u8005\u7b80\u5355\u7684\u88ab\u62b9\u6389(\u5982\u679c\u662f\u4e00\u4e2a\u8f93\u5165\u6d41\u7684\u8bdd)\u3002\u8fd9\u4e2a\u8fc7\u7a0b\u79f0\u4e3a\u540c\u6b65(synchronization)\uff0c\u5b83\u4f1a\u5728\u4ee5\u4e0b\u4efb\u4e00\u60c5\u51b5\u4e0b\u53d1\u751f\uff1a<br \/>\n\u5f53\u6587\u4ef6\u88ab\u5173\u95ed\u65f6: \u5728\u6587\u4ef6\u88ab\u5173\u95ed\u4e4b\u524d\uff0c\u6240\u6709\u8fd8\u6ca1\u6709\u88ab\u5b8c\u5168\u5199\u51fa\u6216\u8bfb\u53d6\u7684\u7f13\u5b58\u90fd\u5c06\u88ab\u540c\u6b65\u3002<br \/>\n\u5f53\u7f13\u5b58buffer \u6ee1\u65f6:\u7f13\u5b58Buffers \u6709\u4e00\u5b9a\u7684\u7a7a\u95f4\u9650\u5236\u3002\u5f53\u7f13\u5b58\u6ee1\u65f6\uff0c\u5b83\u4f1a\u88ab\u81ea\u52a8\u540c\u6b65\u3002<br \/>\n\u63a7\u5236\u7b26\u660e\u786e\u6307\u660e:\u5f53\u9047\u5230\u6d41\u4e2d\u67d0\u4e9b\u7279\u5b9a\u7684\u63a7\u5236\u7b26\u65f6\uff0c\u540c\u6b65\u4f1a\u53d1\u751f\u3002\u8fd9\u4e9b\u63a7\u5236\u7b26\u5305\u62ec\uff1aflush \u548cendl\u3002<br \/>\n\u660e\u786e\u8c03\u7528\u51fd\u6570sync(): \u8c03\u7528\u6210\u5458\u51fd\u6570sync() (\u65e0\u53c2\u6570)\u53ef\u4ee5\u5f15\u53d1\u7acb\u5373\u540c\u6b65\u3002\u8fd9\u4e2a\u51fd\u6570\u8fd4\u56de\u4e00\u4e2aint \u503c\uff0c\u7b49\u4e8e-1 \u8868\u793a\u6d41\u6ca1\u6709\u8054\u7cfb\u7684\u7f13\u5b58\u6216\u64cd\u4f5c\u5931\u8d25\u3002<br \/>\n\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014<br \/>\n\u7248\u6743\u58f0\u660e\uff1a\u672c\u6587\u4e3aCSDN\u535a\u4e3b\u300c\u8ffd\u6c42\u6267\u7740\u300d\u7684\u539f\u521b\u6587\u7ae0\uff0c\u9075\u5faaCC 4.0 BY-SA\u7248\u6743\u534f\u8bae\uff0c\u8f6c\u8f7d\u8bf7\u9644\u4e0a\u539f\u6587\u51fa\u5904\u94fe\u63a5\u53ca\u672c\u58f0\u660e\u3002<br \/>\n\u539f\u6587\u94fe\u63a5\uff1a<a href=\"https:\/\/blog.csdn.net\/kingstar158\/article\/details\/6859379\">https:\/\/blog.csdn.net\/kingstar158\/article\/details\/6859379<\/a><\/p>\n<\/blockquote>\n<h3>C\u8bed\u8a00\u5199\u5165\u6587\u4ef6<\/h3>\n<pre><code class=\"language-c\">#include \u201cstdio.h\"\n\nint main()\n{\n    FILE *fp;\n    fp=fopen(\"2.txt\",\"w\");      \/\/ \u4ee5\u5199\u5165\u7684\u65b9\u5f0f\uff0c\u65b0\u5efa\u6216\u6253\u5f00\u6587\u4ef6\uff0c\u5e76\u5728\u6587\u4ef6\u672b\u5c3e\u6dfb\u52a0\u5185\u5bb9\n    int n=1;\n    fprintf(fp,\"%d\",n);\n    fclose(fp);\n    return 0;\n}<\/code><\/pre>\n<h3>\u5907\u6ce8<\/h3>\n<ol>\n<li>explicit\uff1a\u663e\u5f0f\u5355\u53c2\u6570\u6784\u9020\u51fd\u6570\uff08\u6709\u9ed8\u8ba4\u53c2\u6570\u7684\u591a\u53c2\u4e5f\u53ef\u4ee5\uff09\uff0c\u76ee\u7684\u662f\u9632\u6b62\u9690\u5f0f\u7c7b\u578b\u8f6c\u6362\u5e26\u6765\u7684\u98ce\u9669\uff08\u5982\u51fa\u73b0\u95ee\u9898\u4e0d\u65b9\u4fbf\u6392\u67e5\u7b49\uff09\uff0c\u540c\u65f6\u5bf9\u4e8e\u5355\u53c2\u6784\u9020\u51fd\u6570\u5efa\u8bae\u4f7f\u7528explicit\u5173\u952e\u5b57\u3002<br \/>\n<a href=\"https:\/\/www.jianshu.com\/p\/af8034ec0e7a\">\u53c2\u80031<\/a>\uff0c<a href=\"https:\/\/www.cnblogs.com\/rednodel\/p\/9299251.html\">\u53c2\u80032<\/a><\/li>\n<\/ol>\n<h3>\u53c2\u8003<\/h3>\n<p><a href=\"https:\/\/blog.csdn.net\/kingstar158\/article\/details\/6859379\">C++\u6587\u4ef6\u8bfb\u5199\u8be6\u89e3\uff08ofstream,ifstream,fstream\uff09<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>&emsp;&emsp;\u8fd9\u4e00\u7cfb\u5217\u6587\u7ae0\u7684\u76ee\u7684\u662f\u5728\u5b66\u4e60\u4e86C++\u57fa\u7840\u540e\uff0c\u7ee7\u7eed\u8865\u5145\u4e00\u4e9bC++\u57fa\u7840\u548c\u8fdb\u9636\u7684\u77e5\u8bc6\u70b9\uff0c\u5305\u62ecC++11\u7684\u76f8\u5173\u5185\u5bb9\u3002 \u4ee5C++11\u6807\u51c6\u4e3a\u57fa\u7840\u3002 \u7ee7\u627f\u5173\u7cfb parent c1 c2 c3 c4 ios_base ios istream iostream fstream stringstream ifstream istringstream ostream ofstream ostringstream streambuf filebuf stringbuf C++\u6587\u4ef6\u8bfb\u5199 \u6587\u4ef6\u8bfb\u5199\u7684\u7c7b Narrow characters (char) Wide characters (wchar_t) ifstream wifstream Input file stream class (class ) ofstream wofstream Output file stream (class ) fstream wfstream Input\/output file stream class (class ) filebuf wfilebuf [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[6],"tags":[],"_links":{"self":[{"href":"http:\/\/47.103.123.166\/index.php?rest_route=\/wp\/v2\/posts\/185"}],"collection":[{"href":"http:\/\/47.103.123.166\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/47.103.123.166\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/47.103.123.166\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/47.103.123.166\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=185"}],"version-history":[{"count":2,"href":"http:\/\/47.103.123.166\/index.php?rest_route=\/wp\/v2\/posts\/185\/revisions"}],"predecessor-version":[{"id":201,"href":"http:\/\/47.103.123.166\/index.php?rest_route=\/wp\/v2\/posts\/185\/revisions\/201"}],"wp:attachment":[{"href":"http:\/\/47.103.123.166\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=185"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/47.103.123.166\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=185"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/47.103.123.166\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=185"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}