forked from crazyqk2019/libretro-px68k
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfile.h
64 lines (51 loc) · 1.12 KB
/
file.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
// $fmgen-Id: file.h,v 1.6 1999/11/26 10:14:09 cisc Exp $
#if !defined(win32_file_h)
#define win32_file_h
#include "fmgen_types.h"
// ---------------------------------------------------------------------------
class FileIO
{
public:
enum Flags
{
open = 0x000001,
readonly = 0x000002,
create = 0x000004,
};
enum SeekMethod
{
begin = 0, current = 1, end = 2,
};
enum Error
{
success = 0,
file_not_found,
sharing_violation,
unknown = -1
};
public:
FileIO();
FileIO(const char* filename, uint flg = 0);
virtual ~FileIO();
bool Open(const char* filename, uint flg = 0);
bool CreateNew(const char* filename);
bool Reopen(uint flg = 0);
void Close();
Error GetError() { return error; }
int32 Read(void* dest, int32 len);
int32 Write(const void* src, int32 len);
bool Seek(int32 fpos, SeekMethod method);
int32 Tellp();
bool SetEndOfFile();
uint GetFlags() { return flags; }
void SetLogicalOrigin(int32 origin) { lorigin = origin; }
private:
HANDLE hfile;
uint flags;
uint32 lorigin;
Error error;
char path[MAX_PATH];
FileIO(const FileIO&);
const FileIO& operator=(const FileIO&);
};
#endif //