#ifndef __BINFILE_H
#define __BINFILE_H


#include <io.h>
#include <dos.h>
#include <fcntl.h>
#include <sys/types.h>

#include "ptypes.h"
#include "mytypes.h"


typedef sdword binfilepos;

class binfile
{
public:
  enum
  {
	modeopen=1,
	moderead=2,
	modeseek=8,
  };

private:
  void reset();

  int fd;

protected:
  uintm mode;

public:
  binfile();
  virtual ~binfile();

  errstat open(const char *name, int type);
  errstat close();

  binfilepos read(void huge *buf, binfilepos len); // moderead
  binfilepos seek(binfilepos pos); // modeseek
  binfilepos length();
};


#endif
