Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

CTFile Class Reference
[Low Level Card File System]

#include <ctfilesystem2.h>

List of all members.

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 ()


Detailed Description

Author:
Martin Preuss<martin@libchipcard.de>


Constructor & Destructor Documentation

CTFile::CTFile  ) 
 

CTFile::CTFile CTPointer< CTCardFS medium,
const string &  path
 

Author:
Martin Preuss<martin@libchipcard.de>
Parameters:
medium CTPointer to the medium this file belongs to (card)
path path of the file

CTFile::~CTFile  ) 
 


Member Function Documentation

CTError CTFile::closeFile  )  [inline]
 

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.

Author:
Martin Preuss<martin@libchipcard.de>

CTError CTFile::createFile unsigned int  attribs = CTDirEntry::Attr_USED | CTDirEntry::Attr_READ | CTDirEntry::Attr_WRITE  )  [inline]
 

Creates a file using the given attributes. If a file with that name already exists an error will be returned.

Author:
Martin Preuss<martin@libchipcard.de>

CTError CTFile::flush  )  [inline]
 

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.

Author:
Martin Preuss<martin@libchipcard.de>

CTError CTFile::openFile  )  [inline]
 

Opens a file. It must exist.

Author:
Martin Preuss<martin@libchipcard.de>

int CTFile::position  )  [inline]
 

Returns the current position of the file pointer.

Author:
Martin Preuss<martin@libchipcard.de>
Returns:
current position in the file

unsigned char CTFile::readChar  )  [inline]
 

Read the next character out of the file. If the file pointers show beyond the file's end an error will be thrown.

Author:
Martin Preuss<martin@libchipcard.de>

string CTFile::readString int  len  ) 
 

Reads the next bytes up to the given length. Calls readChar().

Author:
Martin Preuss<martin@libchipcard.de>
Parameters:
len limit for the number of bytes to read

CTError CTFile::removeFile  )  [inline]
 

Removes the file. If it does not exist anyway then an error will be returned. The file must not be open..

Author:
Martin Preuss<martin@libchipcard.de>

CTError CTFile::renameFile const string &  n  )  [inline]
 

Renames this file. This may move this file to a different folder. The file may be open.

Author:
Martin Preuss<martin@libchipcard.de>
Parameters:
n new name

CTError CTFile::seek int  where  )  [inline]
 

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

Author:
Martin Preuss<martin@libchipcard.de>
Parameters:
where position to seek

CTError CTFile::statFile CTDirEntry ent  )  [inline]
 

Collects some information about the file. The file may be open or closed.

Author:
Martin Preuss<martin@libchipcard.de>
Parameters:
ent reference to a CTDirEntry object to receive the info

CTError CTFile::truncateFile  )  [inline]
 

Truncates file to zero.

Author:
Martin Preuss<martin@libchipcard.de>

CTError CTFile::writeChar unsigned char  c  )  [inline]
 

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.

Author:
Martin Preuss<martin@libchipcard.de>

CTError CTFile::writeString const string &  s  )  [inline]
 

Writes a string of data to this file. Calls writeChar().

Author:
Martin Preuss<martin@libchipcard.de>


The documentation for this class was generated from the following file:
Generated on Mon Jan 5 20:56:28 2004 for libchipcard by doxygen 1.3.4