std::basic_filebuf::is_open
性病:基本[医]filebuf::is[医]开着的营业的
bool is_open() const; | | |
---|
回报true
如果最近的电话open()
成功了,没有人呼吁close()
从那以后。
参数
%280%29
返回值
true
如果相关文件打开,false
否则。
注记
此函数通常由std::basic_fstream::is_open()
...
例
二次
#include <fstream>
#include <iostream>
int main()
{
std::ifstream fs("test.txt"
std::filebuf fb;
fb.open("test.txt", std::ios_base::in
std::cout << std::boolalpha
<< "direct call: " << fb.is_open() << '\n'
<< "through streambuf: " << fs.rdbuf()->is_open() << '\n'
<< "through fstream: " << fs.is_open() << '\n';
}
二次
产出:
二次
direct call: true
through streambuf: true
through fstream: true
二次
另见
open | opens a file and configures it as the associated character sequence (public member function) |
---|---|
close | flushes the put area buffer and closes the associated file (public member function) |
© cppreference.com
在CreativeCommonsAttribution下授权-ShareAlike未移植许可v3.0。
http://en.cppreference.com/w/cpp/io/basic[医]filebuf/is[医]开着的营业的