00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #ifndef FILEIO_H
00012 #define FILEIO_H
00013
00014 #ifdef WIN32
00015 #pragma warning( disable : 4133 )
00016 #define NOGDI
00017 #define _WIN32_WINNT 0x0400
00018 #define WIN32_LEAN_AND_MEAN
00019 #include <windows.h>
00020 typedef __int64 FILE_OFFSET;
00021
00022
00023
00024
00025
00026 typedef struct F_HANDLE {
00027 HANDLE handle;
00028 FILE_OFFSET position;
00029 } F_HANDLE;
00030
00031 F_HANDLE *file_open( char *fname, char *mode);
00032
00033 void file_close( F_HANDLE *file );
00034
00035 int file_seek( F_HANDLE *file, FILE_OFFSET position, int whence );
00036
00037 FILE_OFFSET file_tell( F_HANDLE *file );
00038
00039 size_t file_read( void* buffer, size_t size,
00040 size_t number, F_HANDLE *file );
00041
00042 size_t file_write( void* buffer, size_t size,
00043 size_t number, F_HANDLE *file );
00044 #define fopen file_open
00045 #define fclose file_close
00046 #define fseeko file_seek
00047 #define ftello file_tell
00048 #define fread file_read
00049 #define fwrite file_write
00050 #define FILE F_HANDLE
00051 #else
00052 #include <sys/types.h>
00053 typedef off_t FILE_OFFSET;
00054 #endif
00055 #endif // FILEIO_H