TBufferedFile class

Back Up Next

TBufferedFile class

Header File
    <owl/file.h>

Description
    The TBufferedFile class encapsulates the buffered input/output.

Base class:
    TFile

Enumerators
    enum { DefaultBufferSize = 1024};

Constructors
    TBufferedFile::TBufferedFile
        Form 1
            TBufferedFile();    
        Form 2
            TBufferedFile(TFHandle& handle, bool shouldClose);
        Form 3
            TBufferedFile(LPCTSTR name, const uint32 mode = ReadOnly|PermReadWrite|OpenExisting);
    Description
        Form 1: Creates a TFile object with a file handle of FileNull.
        Form 2: Creates a TFile object with a file handle of handle.
        Form 3: Creates a TFile object and opens file name with the given attributes. The file is created if it does not exist.
Destructor
    virtual ~TBufferedFile();

Member Functions
Close()
    Syntax
        bool Close();
    Description
        Closes file stream, flushes all buffers.
#if defined(BI_PLAT_WIN32)
Length
    Syntax
        virtual bool Length(int64 newLen);
    Description
Resizes file to newLen
Position64
    Syntax
        virtual int64 Position64()   const;
    Description
        Returns the current position of the file pointer. Returns -1 to indicate an error.
Length64

    Syntax
        virtual uint64  Length64() const;
    Description
Returns the file length

Position
    Syntax
        virtual uint32  Position() const;
    Description
        Returns the current position of the file pointer. Returns -1 to indicate an error.
Length

    Form 1
        virtual uint32  Length() const;
    Form 2
        virtual bool  Length(long newLen);
    Description
        Form 1: Returns the file length.
        Form 2: Resizes file to newLen.

Seek
    Form 1
        uint32 Seek( long offset, seek_dir origin = beg );
    Form 2
        uint64  Seek(int64 offset, seek_dir origin = beg);
    Description
        Repositions the file pointer to offset bytes from the specified origin, second form valid only for Win32..
Read
    Syntax
        uint32  Read( void *buffer, uint32 numBytes );
    Description
        Reads numBytes from the file into buffer.
Write

    Syntax
        bool  Write(const void* buffer, uint32 numBytes);
    Description
        Writes numBytes to the buffer file buffer.
Flush

    Syntax
        bool  Flush();
    Description
        Flushes buffer.
SetBuffer

    Syntax
        void  SetBuffer(uint8* buffer, uint size, TAutoDelete = AutoDelete);
    Description
        Set new buffer, if buffer == 0, allocate memory

 

Revised: February 09, 2000.


Copyright © 1998-2001 Yura Bidus. All rights reserved.