basic_filebufは、basic_streambufをファイル用に継承したクラス。
バッファを管理するのだが、openやis_openを持っている。
std::basic_filebuf - cppreference.com
デフォルトの引数無しコンストラクタで生成できるが、その場合は当然ファイルに紐付けられていない。
それをis_openで確認できる。
実行すると、
$ vi basic_filebuf.cpp $ g++ basic_filebuf.cpp -o basic_filebuf $ ./basic_filebuf fb.is_open() == false $
開いてない、つまり、紐付けられていない。
Sample/cpp/basic_filebuf/basic_filebuf/src/basic_filebuf at master · bg1bgst333/Sample · GitHub