static_file.hh 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /********************************************************************** <BR>
  2. This file is part of Crack dot Com's free source code release of
  3. Golgotha. <a href="http://www.crack.com/golgotha_release"> <BR> for
  4. information about compiling & licensing issues visit this URL</a>
  5. <PRE> If that doesn't help, contact Jonathan Clark at
  6. golgotha_source@usa.net (Subject should have "GOLG" in it)
  7. ***********************************************************************/
  8. #ifndef STATIC_FILE_HH
  9. #define STATIC_FILE_HH
  10. #include "file/file.hh"
  11. #include <stdio.h>
  12. class i4_static_file_class : public i4_file_class
  13. {
  14. public:
  15. FILE *f;
  16. i4_static_file_class() : f(0) {}
  17. i4_static_file_class(const char *name) : f(0) { }
  18. ~i4_static_file_class() { if (f) fclose(f); }
  19. i4_static_file_class* open(const char *name)
  20. {
  21. if (f)
  22. fclose(f);
  23. f=0;
  24. if (f = fopen(name, "wt"))
  25. return this;
  26. else
  27. return 0;
  28. }
  29. virtual w32 read (void *buffer, w32 size) { return 0; }
  30. virtual w32 write(const void *buffer, w32 size) { return fwrite(buffer, size, 1, f); }
  31. virtual w32 seek (w32 offset) { return 0; }
  32. virtual w32 size () { return 0; }
  33. virtual w32 tell () { return 0; }
  34. };
  35. #endif