#include <FUFile.h>
Public Types | |
enum | Mode { READ, WRITE } |
The file open mode. More... | |
Public Member Functions | |
FUFile (const fstring &filename, Mode mode) | |
Constructor. | |
FUFile (const fchar *filename, Mode mode) | |
See above. | |
FUFile () | |
Default constructor. | |
~FUFile () | |
Destructor. | |
const fstring & | GetFilePath () const |
Retrieves the absolute, OS-specific path used to open this file. | |
bool | Open (const fstring &filename, Mode mode) |
Opens a file on the file system. | |
bool | Open (const fchar *filename, Mode mode) |
See above. | |
bool | IsOpen () |
Retrieves whether a file is attached to this object. | |
size_t | GetLength () |
Retrieves the length, in bytes, of the attached file. | |
FILE * | GetHandle () |
bool | Read (void *buffer, size_t length) |
Reads length bytes of data from this file. | |
bool | Write (const void *buffer, size_t length) |
Writes length bytes of data to this file. | |
void | Flush () |
Flushes the data written to the file. | |
void | Close () |
Closes and detaches the file. |
This class encapsulates synchronous file I/O across different platforms and supports Unicode where the platform does.
|
The file open mode.
|
|
Constructor.
|
|
Default constructor. The file object will not be attached: use the Open function to attach the file object to a file on the file system. |
|
Destructor. Automatically flushes/closes any file left opened. |
|
Flushes the data written to the file. This function will do nothing if the file was not opened in WRITE mode. |
|
Retrieves the absolute, OS-specific path used to open this file.
|
|
|
|
Retrieves the length, in bytes, of the attached file.
|
|
Retrieves whether a file is attached to this object.
|
|
Opens a file on the file system.
|
|
Reads length bytes of data from this file. This function will fail if the file was not opened in READ mode. This function will advance the FILE pointer length bytes ahead.
|
|
Writes length bytes of data to this file. This function will fail if the file was not opened in WRITE mode.
|