
#include <iostream>
#include <fstream>
#include <cstdio>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>

#include "UncompressedFile.hpp"

using namespace std;

int main()
{
  UncompressedFile f("memory_usage0.dat");
  int fd = open("comptest.dat",O_WRONLY|O_TRUNC|O_CREAT,0666);
  unsigned char x[500];
  int len;

  if(fd < 0)
    {
      cerr << "output file open failed" << endl;
      abort();
    }

  while((len=f.read(x,500))>0)
    {
      write(fd,x,len);
    }
  return 0;
}
