Skip to content

Latest commit

 

History

History
44 lines (33 loc) · 640 Bytes

File metadata and controls

44 lines (33 loc) · 640 Bytes

is_open

  • fstream[meta header]
  • std[meta namespace]
  • basic_fstream[meta class]
  • function[meta id-type]
bool is_open() const;

概要

開いている状態であることの判定をする。

戻り値

rdbuf()->is_open()

#include <iostream>
#include <fstream>

int main()
{
  std::fstream fs("foo", std::ios_base::out);
  if (fs.is_open()) {
    std::cout << "opened" << std::endl;
  }
}
  • std::fstream[link /reference/fstream/basic_fstream.md]
  • is_open()[color ff0000]

出力

opened

バージョン

言語

  • C++98