Changeset 206 for cpp/frams/virtfile/stdiofile.h
- Timestamp:
- 04/03/14 01:24:30 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
cpp/frams/virtfile/stdiofile.h
r197 r206 8 8 #include "virtfile.h" 9 9 #include <frams/util/sstring.h> 10 #ifdef USE_MFILE 11 #include <common/nonstd_stdio.h> 12 #else 10 13 #include <stdio.h> 14 #endif 11 15 #include <common/nonstd_dir.h> 12 16 … … 19 23 }; 20 24 25 #ifdef USE_MFILE 26 class StdioFILE: public VirtFILE 27 { 28 protected: 29 MFILE *file; 30 SString path; 31 public: 32 StdioFILE(MFILE *f) {file=f;} 33 StdioFILE(MFILE *f,const SString& p) {file=f;path=p;} 34 static void setStdio(); 35 int Vread(void *ptr, size_t size, size_t nmemb) {return mfread(ptr,size,nmemb,file);} 36 int Vwrite(const void *ptr, size_t size, size_t nmemb) {return mfwrite(ptr,size,nmemb,file);} 37 int Veof() {return mfeof(file);} 38 int Vputs(const char *s) {return mfputs(s,file);} 39 char *Vgets(char *s, int size) {return mfgets(s,size,file);} 40 int Vseek(long offset, int whence) {return mfseek(file,offset,whence);} 41 int Vtell() {return mftell(file);} 42 int Vflush() {return 0;/*NOT IMPLEMENTED!*/;} 43 const char* VgetPath() {return path;} 44 45 ~StdioFILE() {if (file) fclose(file);} 46 }; 47 #else 21 48 class StdioFILE: public VirtFILE 22 49 { … … 44 71 ~StdioFILE() {if (file) fclose(file);} 45 72 }; 73 #endif 46 74 47 75 class StdioDIR: public VirtDIR … … 57 85 { 58 86 public: 87 #ifdef USE_MFILE 88 StdioFILEDontClose(MFILE *f):StdioFILE(f) {} 89 #else 59 90 StdioFILEDontClose(FILE *f):StdioFILE(f) {} 91 #endif 60 92 ~StdioFILEDontClose() {file=0;} 61 93 };
Note: See TracChangeset
for help on using the changeset viewer.