RASCSI/cpp/rasdump_fileio.h
Daniel Markstedt 08194af424
Move C++ code into cpp/ dir (#941)
- Moved C++ code to cpp/ from src/raspberrypi
- Related updates to Makefile, easyinstall.sh, and the github build rules
- Removed the native X68k C code in src/x68k from the repo
2022-10-25 12:59:30 -07:00

43 lines
851 B
C++
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

//---------------------------------------------------------------------------
//
// X68000 EMULATOR "XM6"
//
// Copyright (C) 2001-2005 (ytanaka@ipc-tokai.or.jp)
// Copyright (C) 2013-2020 GIMONS
// [ File I/O (Subset for RaSCSI) ]
//
//---------------------------------------------------------------------------
#pragma once
#include "os.h"
#include <cstdlib>
class Fileio
{
public:
enum class OpenMode {
ReadOnly,
WriteOnly,
ReadWrite
};
Fileio() = default;
virtual ~Fileio();
Fileio(Fileio&) = default;
Fileio& operator=(const Fileio&) = default;
bool Open(const char *fname, OpenMode mode);
bool Read(BYTE *buffer, int size) const;
bool Write(const BYTE *buffer, int size) const;
off_t GetFileSize() const;
void Close();
private:
bool Open(const char *fname, OpenMode mode, bool directIO);
int handle = -1;
};