home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 8 / FreshFishVol8-CD1.bin / gnu / lib / g++-include / sfile.h < prev    next >
C/C++ Source or Header  |  1994-12-22  |  2KB  |  54 lines

  1. /* This is part of libio/iostream, providing -*- C++ -*- input/output.
  2. Copyright (C) 1988, 1992, 1993 Free Software Foundation
  3.     written by Doug Lea (dl@rocky.oswego.edu)
  4.  
  5. This file is part of the GNU IO Library.  This library is free
  6. software; you can redistribute it and/or modify it under the
  7. terms of the GNU General Public License as published by the
  8. Free Software Foundation; either version 2, or (at your option)
  9. any later version.
  10.  
  11. This library is distributed in the hope that it will be useful,
  12. but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14. GNU General Public License for more details.
  15.  
  16. You should have received a copy of the GNU General Public License
  17. along with GNU CC; see the file COPYING.  If not, write to
  18. the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
  19.  
  20. As a special exception, if you link this library with files
  21. compiled with a GNU compiler to produce an executable, this does not cause
  22. the resulting executable to be covered by the GNU General Public License.
  23. This exception does not however invalidate any other reasons why
  24. the executable file might be covered by the GNU General Public License. */
  25.  
  26. #ifndef _SFile_h
  27. #ifdef __GNUG__
  28. #pragma interface
  29. #endif
  30. #define _SFile_h 1
  31.  
  32. #include <fstream.h>
  33.  
  34. class SFile: public fstream
  35. {
  36.   protected:
  37.     int       sz;                   // unit size for structured binary IO
  38.  
  39. public:
  40.     SFile() : fstream() { }
  41.     SFile(int fd, int size);
  42.     SFile(const char *name, int size, int mode, int prot=0664);
  43.     void open(const char *name, int size, int mode, int prot=0664);
  44.     
  45.     int       size() { return sz; }
  46.     int       setsize(int s) { int old = sz; sz = s; return old; }
  47.     
  48.     SFile&    get(void* x);
  49.     SFile&    put(void* x);
  50.     SFile&    operator[](long i);
  51. };
  52.  
  53. #endif
  54.