FileIO implements file-based IO.
More...
#include <FileIO.h>
List of all members.
Public Member Functions |
void | init (const char *path, const char *mode) |
| Initialize with the file path and access mode.
|
void | init (const char *tempdir) |
| Create a temporary file for readeing and writing.
|
void | unlink (void) |
| Delete the resource when the IO object is deleted.
|
Static Public Member Functions |
static void | deleteFile (const char *path) |
| Delete a file.
|
static bool | fileExists (const char *path) |
| Test if the file exists.
|
Protected Attributes |
Mutex | m_openLock |
int | m_openCount |
bool | m_unlinkFile |
Detailed Description
The FileIO class implements a file-based IO object. It uses the pread() and pwrite() on POSIX systems and ReadFile() and WriteFile() with overlaps on Windows systems.
- See also:
- See examples/src/support.cpp compareFiles() for an example of reading a file.
Definition at line 30 of file FileIO.h.
Member Function Documentation
This is utility function for deleting a file.
- Parameters:
-
This is utility function for seeing if the file exists.
- Parameters:
-
This method initializes the FileIO object with a filename path and access mode.
Modes:
- "r": Open a file for reading.
- "r+": Open a file for reading and writing.
- "w": Truncate or create a file for writing.
- "w+": Truncate or create a file for reading and writing.
- Parameters:
-
path | the filename path (UTF-8 encoded) |
mode | the file access mode |
This method creates temporary file for reading and writing. When the FileIO object is deallocted the temporary file is deleted. If tempdir is NULL the default temporary directory is used.
- Parameters:
-
tempdir | the location of the temporary directory (UTF-8 encode) |
This method marks the resource for deletion when the object goes away.
Implements IO.
Member Data Documentation
The documentation for this class was generated from the following file: