PFileStream Class Reference

Detailed Description

The PFileStream class is a PByteStream whose backing store is a binary file.

Definition at line 24 of file PFileStream.h.

#include <PFileStream.h>

Member Enumeration Documentation

◆ EOpenFlags

All the available file opening flags.

Enumerator
E_APPEND 

Seek to the end of stream before each write.

E_READ 

Open for reading.

E_WRITE 

Open for writing.

E_TRUNC 

Discard the contents of the stream when opening.

E_REWRITE 

Open for writing; discard the contents of the stream when opening.

Definition at line 30 of file PFileStream.h.

Constructor & Destructor Documentation

◆ PFileStream() [1/2]

PFileStream::PFileStream ( )

Creates an empty (not initialised) file stream.

See also
Open()

◆ PFileStream() [2/2]

PFileStream::PFileStream ( const PFileStream other)

Constructs a shared copy of other.

◆ ~PFileStream()

virtual PFileStream::~PFileStream ( )
virtual

Closes the stream and destroys this object.

Member Function Documentation

◆ Open()

static PResult PFileStream::Open ( const PString filename,
int  openFlags,
PFileStream fileStream 
)
static

Opens a stream from the specified binary file for reading or writing.

Possible openFlags are the following:

  • E_APPEND
  • E_READ
  • E_WRITE
  • E_TRUNC
  • E_REWRITE

Returns PResult::C_OK if success, another result otherwise.

◆ operator=()

PFileStream& PFileStream::operator= ( const PFileStream other)

Performs a shared copy of other to this object.