最終更新日時(UTC):
が更新

履歴 編集

function
<fstream>

std::basic_ifstream::is_open

bool is_open() const;

概要

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

戻り値

rdbuf()->is_open()

#include <iostream>
#include <fstream>

int main()
{
  std::ifstream fs("foo", std::ios_base::in);
  if (fs.is_open()) {
      std::cout << "opened" << std::endl;
  }
}

出力

バージョン

言語

  • C++98