AwakeMUD-0.8.18B/
AwakeMUD-0.8.18B/doc/
AwakeMUD-0.8.18B/lib/
AwakeMUD-0.8.18B/lib/etc/
AwakeMUD-0.8.18B/lib/etc/pfiles/
AwakeMUD-0.8.18B/lib/misc/
AwakeMUD-0.8.18B/lib/text/
AwakeMUD-0.8.18B/lib/text/help/
AwakeMUD-0.8.18B/lib/text/wizhelp/
AwakeMUD-0.8.18B/lib/veh/
AwakeMUD-0.8.18B/lib/world/
AwakeMUD-0.8.18B/lib/world/mob/
AwakeMUD-0.8.18B/lib/world/mtx/
AwakeMUD-0.8.18B/lib/world/qst/
AwakeMUD-0.8.18B/lib/world/shp/
AwakeMUD-0.8.18B/lib/world/veh/
// file: file.h
// author: Andrew Hynek
// contents: a buffer-friendly and graceful error-handling file class

#ifndef __file_h__
#define __file_h__

//struct FILE;

class File
{
  static const int MAX_FILE_LENGTH = 128;

  FILE *fl;
  char filename[MAX_FILE_LENGTH];
  char mode[8];
  int line_num;

public:
  File();
  File(const char *_filename, const char *_mode);
  ~File();

  // access/query functions
  //
  const char *Filename() const
  {
    return filename;
  }
  const char *Mode() const
  {
    return mode;
  }
  int LineNumber() const  // only working for reading
  {
    return line_num;
  }

  bool IsOpen() const
  {
    return (fl != NULL);
  }
  inline bool IsWriteable() const;

  bool EoF() const;

  // mutation functions
  //
  bool Open(const char *_filename, const char *_mode);
  bool Close();

  void Rewind();
  inline int  Seek(long offset, int origin);

  // '*' at the beginning of a line marks it as a comment,
  // strips the newline,
  bool GetLine(char *buf, size_t buf_size, bool blank);

  // reads a '~'-terminated string from the file, returns a newly-allocated
  // string.  Much like fread_string, only better.
  char *ReadString();

  // only works if vfprintf is defined
  // Note: this DOESN'T work on my slack8 machine, so I'd advise avoiding it
  //     : altogether for now.  Maybe sooner or later (maybe).
  int  Print(const char *format, ...);
};

#endif // ifndef __file_h__