#include "MFile.h"
#include "Exception.h"
#include <sys/stat.h>

namespace coreutils {
   
   MFile::MFile(coreutils::MString fileName) : fileName(fileName) {
      inFile.open(fileName.c_str());
      *this << inFile;
      inFile.close();      
   }

   MFile::~MFile() {
      update();
   }
      
   void MFile::update() {
      outFile.open(fileName.c_str());
      outFile << *this;
      outFile.close();
   }   

}
