// $Id: file.h,v 1.1.1.1 2000/11/02 08:47:16 fritzi Exp $ // This file is part of the DEAL Library // DEAL is Copyright(1995) by // Roland Becker, Guido Kanschat, Franz-Theo Suttmeier #ifndef __file_h #define __file_h #include #ifndef __errors_h #include #endif /* CLASS File */ class File { FILE * p; protected: ////////// File(const char* name, const char* mode) { p = fopen(name,mode); THROWUNCOND(!p, StringError(StringError::NoFile,name)); } ////////// ~File() { fclose(p); } public: ////////// operator FILE*() { return p; } }; /* CLASS ReadFile */ class ReadFile : public File { public: ////////// ReadFile(const char* name) : File(name,"r") {} }; /* CLASS WriteFile */ class WriteFile : public File { public: ////////// WriteFile(const char* name) : File(name,"w") {} }; #endif