| #ifndef _FILE_H | |
| #define _FILE_H | |
| #include "globals.h" | |
| #include <stdio.h> | |
| #define SEEK__BEGIN 0 | |
| #define SEEK__CURRENT 1 | |
| #define SEEK__END 2 | |
| class File | |
| { | |
| public: | |
| bool _closed; | |
| #ifdef WINDOWS | |
| HANDLE _file; | |
| File(STRING filePath, bool read); | |
| #else | |
| FILE* _file; | |
| File(STRING filePath, const char* mode); | |
| #endif | |
| public: | |
| ~File(void); | |
| bool Seek(File* file,long position, int origin); | |
| bool Write(File* file,BYTE* buffer, UINT bytesToWrite); | |
| bool Close(File* file); | |
| UINT Read(File* file,BYTE* buffer, UINT bytesToRead); | |
| static File* Create(STRING filePath); | |
| static File* Open(STRING filePath); | |
| public: | |
| // return current position in file | |
| UINT GetCurentPos(File* file); | |
| public: | |
| UINT ReadUINT(File* file); | |
| public: | |
| bool Skip(File* file,long bytesToSkip); | |
| public: | |
| static bool CreateDirectory(STRING name); | |
| }; | |
| #endif |