[APE Index] [APE Hierarchy] [Headers]
Portable disk file access. More...
#include <file.h>
The purpose of this class is to define a low level file access class that is portable between Win32 and Posix systems. In fact win32 lacks certain critical concepts related to multi-user file ownership and yet introduces some very odd concepts of cache control and configuration based on assumed application usage. These combine to make this and the other related portable file access classes a little odd, and certainly in need of further work.
[public]
Open an existing file of the given name with the given access mode. Valid access modes include FILE_OPEN_READONLY, FILE_OPEN_WRITEONLY, FILE_OPEN_APPEND, FILE_OPEN_READWRITE, FILE_OPEN_SYNC, and FILE_OPEN_TRUNCATE. A File "exception" is thrown if the file open fails.
access | mode for access to the given file. |
fname | name of file path to open. |
[public]
Create a new file and access for use by the File class. Valid modes include FILE_OPEN_WRITEONLY, FILE_OPEN_APPEND, FILE_OPEN_SYNC, and FILE_OPEN_READWRITE. The most generic permissions for your newly created file include FILE_PERM_PRIVATE, FILE_PERM_GROUP, and FILE_PERM_PUBIC. On Posix systems, the standard chmod() permission values may be directly used, as well as the stat.h defines. As with all APE classes, an exception is thrown if the create fails.
fname | name of file path to create and open. |
[public]
Open a copy of an existing "File" through a duplicate object. This essentially uses the Posix dup() call to duplicate the file descriptor involved.
f | an existing File class to duplicate from. |
[public]
Create a File "class" to reference an existing and already open file descriptor. This is kind of like "fdopen" in purpose, and simply allows any existing file descriptor to be manipulated by the File methods.
fd | an existing and already open file descriptor. |
[public virtual]
The destructor normally closes the File descriptor and should also release any allocated resources in a derived class.
[public]
Read an arbitrary number of bytes from the File object.
buf | pointer to hold read data. |
len | number of bytes to read. |
[public]
Write an arbitrary number of bytes to the File object.
buf | pointer to data that will be written. |
len | number of butes to write. |
[public]
A quick and easy way to write a null terminated C string to a file.
pointer | to null terminated string to write to the file. |
[public]
Set the current file position. This is an absolute position from the start of the file.
pos | new file position to set file to. |
[public]
Set the current file position to the end of the file.
| Kdoc |