DOSBox-X
|
00001 #ifndef NP2_X11_DOSIO_H__ 00002 #define NP2_X11_DOSIO_H__ 00003 00004 #include <stdio.h> 00005 00006 typedef FILE * FILEH; 00007 #define FILEH_INVALID NULL 00008 00009 #define FSEEK_SET SEEK_SET 00010 #define FSEEK_CUR SEEK_CUR 00011 #define FSEEK_END SEEK_END 00012 00013 enum { 00014 FILEATTR_READONLY = 0x01, 00015 FILEATTR_HIDDEN = 0x02, 00016 FILEATTR_SYSTEM = 0x04, 00017 FILEATTR_VOLUME = 0x08, 00018 FILEATTR_DIRECTORY = 0x10, 00019 FILEATTR_ARCHIVE = 0x20 00020 }; 00021 00022 enum { 00023 FLICAPS_SIZE = (1 << 0), 00024 FLICAPS_ATTR = (1 << 1), 00025 FLICAPS_DATE = (1 << 2), 00026 FLICAPS_TIME = (1 << 3) 00027 }; 00028 00029 typedef struct { 00030 UINT16 year; /* cx */ 00031 BYTE month; /* dh */ 00032 BYTE day; /* dl */ 00033 } DOSDATE; 00034 00035 typedef struct { 00036 BYTE hour; /* ch */ 00037 BYTE minute; /* cl */ 00038 BYTE second; /* dh */ 00039 } DOSTIME; 00040 00041 typedef struct { 00042 UINT caps; 00043 UINT32 size; 00044 UINT32 attr; 00045 DOSDATE date; 00046 DOSTIME time; 00047 char path[MAX_PATH]; 00048 } FLINFO; 00049 00050 00051 /* DOSIO:関数の準備 */ 00052 void dosio_init(void); 00053 void dosio_term(void); 00054 00055 /* ファイル操作 */ 00056 FILEH file_open(const OEMCHAR *path); 00057 FILEH file_open_rb(const OEMCHAR *path); 00058 FILEH file_create(const OEMCHAR *path); 00059 long file_seek(FILEH handle, long pointer, int method); 00060 UINT file_read(FILEH handle, void *data, UINT length); 00061 UINT file_write(FILEH handle, const void *data, UINT length); 00062 short file_close(FILEH handle); 00063 UINT file_getsize(FILEH handle); 00064 short file_getdatetime(FILEH handle, DOSDATE *dosdate, DOSTIME *dostime); 00065 short file_delete(const OEMCHAR *path); 00066 short file_attr(const OEMCHAR *path); 00067 short file_dircreate(const OEMCHAR *path); 00068 00069 /* カレントファイル操作 */ 00070 void file_setcd(const OEMCHAR *exepath); 00071 char *file_getcd(const OEMCHAR *sjis); 00072 FILEH file_open_c(const OEMCHAR *sjis); 00073 FILEH file_open_rb_c(const OEMCHAR *sjis); 00074 FILEH file_create_c(const OEMCHAR *sjis); 00075 short file_delete_c(const OEMCHAR *sjis); 00076 short file_attr_c(const OEMCHAR *sjis); 00077 00078 void file_cpyname(char *dst, const char *src, int maxlen); 00079 void file_catname(char *path, const char *filename, int maxlen); 00080 BOOL file_cmpname(const char *path, const char *path2); 00081 OEMCHAR *file_getname(const OEMCHAR *path); 00082 void file_cutname(OEMCHAR *path); 00083 OEMCHAR *file_getext(const OEMCHAR *path); 00084 void file_cutext(OEMCHAR *path); 00085 void file_cutseparator(OEMCHAR *path); 00086 void file_setseparator(OEMCHAR *path, int maxlen); 00087 00088 #endif /* NP2_X11_DOSIO_H__ */