home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The C Users' Group Library 1994 August
/
wc-cdrom-cusersgrouplibrary-1994-08.iso
/
listings
/
v_11_07
/
unixfile.c
< prev
next >
Wrap
Text File
|
1993-01-07
|
871b
|
33 lines
/*** UnixFile Class Implementation: unixfile.c ***/
#include "file.h"
#include "unixfile.h"
CONSTRUCTOR(UnixFile,(const char *name,int flags,int mode))
CONSTRUCT(File,())
this->descriptor = open(name,flags,mode);
assert(this->descriptor >= 0);
END_CONSTRUCTOR
DESTRUCTOR(UnixFile)
close(this->descriptor);
END_DESTRUCTOR
METHOD(UnixFile, Seek, (long offset, int whence), long)
return lseek(this->descriptor,offset,whence);
END_METHOD
METHOD(UnixFile, Read, (void *buffer, int nbytes), int)
return read(this->descriptor,buffer,nbytes);
END_METHOD
METHOD(UnixFile, Write, (void *buffer, int nbytes), int)
return write(this->descriptor,buffer,nbytes);
END_METHOD
DEF_CLASS(UnixFile,File)
REDEF_METHOD(UnixFile,File,Seek);
REDEF_METHOD(UnixFile,File,Read);
REDEF_METHOD(UnixFile,File,Write);
END_CLASS