//: C04:FileClass.cpp {O} // From "Thinking in C++, Volume 2", by Bruce Eckel & Chuck Allison. // (c) 1995-2004 MindView, Inc. All Rights Reserved. // See source code use permissions stated in the file 'License.txt', // distributed with the code package available at www.MindView.net. // FileClass Implementation. #include "FileClass.h" #include #include using namespace std; FileClass::FileClass(const char* fname, const char* mode) { if((f = fopen(fname, mode)) == 0) throw FileClassError("Error opening file"); } FileClass::~FileClass() { fclose(f); } FILE* FileClass::fp() { return f; } ///:~