C4 Engine Terathon Software C4 Engine API Documentation

• File Manager

API Links
Developer Links

class File

Defined in:  C4Files.h
The File class is used for reading from and writing to disk files.
Definition

class File : public Completable<File>, public ListElement<File>

Member Functions
File::Open Opens a file.
File::Close Closes a file.
File::Read Reads data from a file synchronously.
File::Write Writes data to a file synchronously.
File::ReadAsync Reads data from a file asynchronously.
File::WriteAsync Writes data to a file asynchronously.
File::GetPosition Returns the current read/write position for a file.
File::SetPosition Sets the current read/write position for a file.
File::GetSize Returns the current size of a file.
File::Complete Indicates whether an asynchronous operation has completed.
File::GetResultCode Returns the result of an asynchronous operation.
Constructor

File();

Description
The File class encapsulates the opening, closing, reading, and writing of disk files. Once a File object has been constructed, a file can be opened using the File::Open function. A file is automatically closed when the File object is destroyed, but it's also possible to explicitly close a file using the File::Close function.

File objects support both synchronous and asynchronous read and write operations. Operations occur synchronously when the File::Read and File::Write functions are used and occur asynchronously when the File::ReadAsync and File::WriteAsync functions are used.
Base Classes
Completable<File> Used for asynchronous read and write operations. When an asynchronous operation completes, the file object's completion procedure is invoked.
ListElement<File> Used internally by the File Manager.
See Also
File::Open

File::Close

FileMgr