source: golgotha/src/i4/file/static_file.hh @ 80

Last change on this file since 80 was 80, checked in by Sam Hocevar, 12 years ago
  • Adding the Golgotha source code. Not sure what's going to be interesting in there, but since it's all public domain, there's certainly stuff to pick up.
File size: 1.2 KB
Line 
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
9#ifndef STATIC_FILE_HH
10#define STATIC_FILE_HH
11
12#include "file/file.hh"
13#include <stdio.h>
14
15class i4_static_file_class : public i4_file_class
16{
17public:
18  FILE *f;
19
20  i4_static_file_class() : f(0) {}
21  i4_static_file_class(const char *name) : f(0) {  }
22  ~i4_static_file_class() { if (f) fclose(f); }
23
24  i4_static_file_class* open(const char *name)
25  {
26    if (f)
27      fclose(f);
28    f=0;
29
30    if (f = fopen(name, "wt"))
31      return this;
32    else
33      return 0;
34  }
35
36  virtual w32 read (void *buffer, w32 size) { return 0; }
37  virtual w32 write(const void *buffer, w32 size) { return fwrite(buffer, size, 1, f); }
38  virtual w32 seek (w32 offset) { return 0; }
39  virtual w32 size () { return 0; }
40  virtual w32 tell () { return 0; }
41};
42
43#endif
Note: See TracBrowser for help on using the repository browser.