Click on the banner to return to the Class Reference home page.

©Copyright 1996 Rogue Wave Software

RWFile

Synopsis

#include <rw/rwfile.h>
RWFile f("filename");

Description

Class RWFile encapsulates binary file operations using the Standard C stream library (functions fopen(), fread(), fwrite(), etc.). This class is based on class PFile of the Interviews Class Library (1987, Stanford University). The member function names begin with upper case letters in order to maintain compatibility with class PFile .

Because this class is intended to encapsulate binary operations, it is important that it be opened using a binary mode. This is particularly important under MS-DOS -- otherwise bytes that happen to match a newline will be expanded to (carriage return, line feed).

Persistence

None

Public Constructors

RWFile(const char* filename, const char* mode = 0);
~RWFile();

Public Member Functions

const char*
Access();
void
ClearErr();
RWoffset
CurOffset();
RWBoolean
Eof();
RWBoolean
Erase();
RWBoolean
Error();
RWBoolean
Exists();
RWBoolean
Flush();
const char*
GetName();
FILE*
GetStream();
RWBoolean
IsEmpty();
RWBoolean
isValid() const;
RWBoolean
Read(char& c);
RWBoolean
Read(wchar_t& wc);
RWBoolean
Read(short& i);
RWBoolean
Read(int& i);
RWBoolean
Read(long& i);
RWBoolean
Read(unsigned char& c);
RWBoolean
Read(unsigned short& i);
RWBoolean
Read(unsigned int& i);
RWBoolean
Read(unsigned long& i);
RWBoolean
Read(float& f);
RWBoolean
Read(double& d);
RWBoolean
Read(char* i,          size_t count);
RWBoolean
Read(wchar_t* i,       size_t count);
RWBoolean
Read(short* i,         size_t count);
RWBoolean
Read(int* i,           size_t count);
RWBoolean
Read(long* i,          size_t count);
RWBoolean
Read(unsigned char* i, size_t count);
RWBoolean
Read(unsigned short* i,size_t count);
RWBoolean
Read(unsigned int* i,  size_t count);
RWBoolean
Read(unsigned long* i, size_t count);
RWBoolean
Read(float* i,         size_t count);
RWBoolean
Read(double* i,        size_t count);
RWBoolean
Read(char* string);
RWBoolean
SeekTo(RWoffset offset);
RWBoolean
SeekToBegin();
RWBoolean
SeekToEnd();
RWBoolean
Write(char i);
RWBoolean
Write(wchar_t i);
RWBoolean
Write(short i);
RWBoolean
Write(int i);
RWBoolean
Write(long i);
RWBoolean
Write(unsigned char i);
RWBoolean
Write(unsigned short i);
RWBoolean
Write(unsigned int i);
RWBoolean
Write(unsigned long i);
RWBoolean
Write(float f);
RWBoolean
Write(double d);
RWBoolean
Write(const char* i,          size_t count);
RWBoolean
Write(const wchar_t* i,       size_t count);
RWBoolean
Write(const short* i,         size_t count);
RWBoolean
Write(const int* i,           size_t count);
RWBoolean
Write(const long* i,          size_t count);
RWBoolean
Write(const unsigned char* i, size_t count);
RWBoolean
Write(const unsigned short* i,size_t count);
RWBoolean
Write(const unsigned int* i,  size_t count);
RWBoolean
Write(const unsigned long* i, size_t count);
RWBoolean
Write(const float* i,         size_t count);
RWBoolean
Write(const double* i,        size_t count);
RWBoolean
Write(const char* string);

Static Public Member Functions

static RWBoolean
Exists(const char* filename, int mode = F_OK);