00001 #ifndef __FILEMGR_H__ 00002 #define __FILEMGR_H__ 00003 /*============================================================================= 00004 Module : filemgr.h 00005 Purpose : Define a file manager object. 00006 Author : Doug Ehlenberger, CNIC Mt. Sinai School of Medicine 00007 00008 =============================================================================*/ 00009 #include <stdlib.h> 00010 #include <stdio.h> 00011 #include "configure.h" 00012 #include "resourcemgr.h" 00013 #include "handle.h" 00014 00015 00016 typedef vHANDLE vHFILE; 00017 00018 typedef ResourceManager FileManager; 00019 00020 00021 /*----------------------------------------------------------------------------- 00022 Create a file manager structure. 00023 Returns a pointer to the structure or NULL on failure. 00024 -----------------------------------------------------------------------------*/ 00025 FileManager* CreateFileManager 00026 ( 00027 vSIZE numFiles 00028 ); 00029 00030 00031 /*----------------------------------------------------------------------------- 00032 Free the memory allocated for the file manager structure. 00033 -----------------------------------------------------------------------------*/ 00034 vVOID DestroyFileManager 00035 ( 00036 FileManager **manager 00037 ); 00038 00039 00040 /*----------------------------------------------------------------------------- 00041 Get a handle to a file stream. 00042 -----------------------------------------------------------------------------*/ 00043 vHFILE FileOpen 00044 ( 00045 FileManager *manager, 00046 vSTRING fileName, 00047 vSTRING mode 00048 ); 00049 00050 00051 /*----------------------------------------------------------------------------- 00052 Read a specified number of bytes from the file stream into the buffer. 00053 -----------------------------------------------------------------------------*/ 00054 vBOOL FileRead 00055 ( 00056 FileManager *manager, 00057 vHFILE fileHandle, 00058 vSIZE bytes, 00059 vVOID *buffer 00060 ); 00061 00062 00063 /*----------------------------------------------------------------------------- 00064 Write a specified number of bytes from the bufferto the file stream. 00065 -----------------------------------------------------------------------------*/ 00066 vBOOL FileWrite 00067 ( 00068 FileManager *manager, 00069 vHFILE fileHandle, 00070 vSIZE bytes, 00071 vVOID *buffer 00072 ); 00073 00074 00075 /*----------------------------------------------------------------------------- 00076 Seeks a specified number of bytes from the indicated location in the file. 00077 The location argument values are equivalent to those for fseek(). 00078 -----------------------------------------------------------------------------*/ 00079 vBOOL FileSeek 00080 ( 00081 FileManager *manager, 00082 vHFILE fileHandle, 00083 vSIZE bytes, 00084 vINT location 00085 ); 00086 00087 00088 /*----------------------------------------------------------------------------- 00089 Retrieves a character from a file stream or EOF. 00090 -----------------------------------------------------------------------------*/ 00091 vINT GetChar 00092 ( 00093 FileManager *manager, 00094 vHFILE fileHandle 00095 ); 00096 00097 00098 /*----------------------------------------------------------------------------- 00099 Output a character to a file stream. 00100 -----------------------------------------------------------------------------*/ 00101 vVOID PutChar 00102 ( 00103 FileManager *manager, 00104 vHFILE fileHandle, 00105 vINT character 00106 ); 00107 00108 00109 #endif/* __FILEMGR_H__ */ 00110
1.5.8