#include <ctfilesystem2.h>
Public Member Functions | |
Constructors and destructors | |
CTFile () | |
CTFile (CTPointer< CTCardFS > medium, const string &path) | |
~CTFile () | |
Opening, creating and closing operations | |
Guess what these methods do... Some operations need the file to be open. | |
CTError | openFile () |
CTError | closeFile () |
CTError | createFile (unsigned int attribs=CTDirEntry::Attr_USED|CTDirEntry::Attr_READ|CTDirEntry::Attr_WRITE) |
Renaming, removing, truncating or stating a file | |
These operations perform with the file beeing either open or closed (except removeFile, it needs the file to be closed). | |
CTError | removeFile () |
CTError | renameFile (const string &n) |
CTError | statFile (CTDirEntry &ent) |
CTError | truncateFile () |
Seeking operations | |
These methods deal with the current position within the file. Obviously it needs to be open for these methods to perform. | |
CTError | seek (int where) |
int | position () |
Reading and writing | |
The following methods allow reading and writing data to/from a file and advance the file pointer. The file needs to be open. | |
unsigned char | readChar () |
string | readString (int len) |
CTError | writeChar (unsigned char c) |
CTError | writeString (const string &s) |
CTError | flush () |
|
|
|
|
|
|
|
Close a file that has been opened or created. There is no nest counter, if the file is not open an error will be returned.
|
|
Creates a file using the given attributes. If a file with that name already exists an error will be returned.
|
|
Flushes this file, which means all unwritten data will be written to the medium. Well, it will rather be written to the cache of the file system.
|
|
Opens a file. It must exist.
|
|
Returns the current position of the file pointer.
|
|
Read the next character out of the file. If the file pointers show beyond the file's end an error will be thrown.
|
|
Reads the next bytes up to the given length. Calls readChar().
|
|
Removes the file. If it does not exist anyway then an error will be returned. The file must not be open..
|
|
Renames this file. This may move this file to a different folder. The file may be open.
|
|
Seeks to the given position. If the position is beyond the end of this file no error is returned ! If a write follwos then the file will grow to fit the size indicated by the file position. An immediate read request however will fail
|
|
Collects some information about the file. The file may be open or closed.
|
|
Truncates file to zero.
|
|
Writes a character to the current position in the file and advances the file pointer. If the write position is beyond the end of file an appropriate number of blocks will be allocated for this file and assigned to it.
|
|
Writes a string of data to this file. Calls writeChar().
|