Standard I/O file class. More...
#include <StdioFile.h>
Public Types | |
enum | OpenMode { ModeRead, ModeWrite, ModeReadWrite, ModeAppend, ModeUpdate } |
Public Member Functions | |
StdioFile () | |
Class constructor. | |
virtual | ~StdioFile () |
Class destructor. | |
bool | open (const char *fileName, OpenMode mode) |
Open file. | |
bool | close () |
Close file. | |
bool | isEOF () |
Get End-of-File flag. | |
bool | writeData (const void *pData, size_t dataLen) |
Write data to file. | |
size_t | readData (void *pData, size_t maxLen) |
Read data from file. | |
long | getSize () |
Get file size. | |
bool | writeString (const char *strData) |
Write string to file. | |
std::string | readString () |
Read string from file. | |
Protected Attributes | |
FILE * | fileStream |
Standard I/O file class.
I/O file class is a wrapper for basic libC stream I/O calls. StdioFile class also calls Media class methods internally, to support for transparent media mounting.
enum StdioFile::OpenMode |
File access modes
StdioFile::StdioFile | ( | ) |
Class constructor.
Initializes the I/O file object.
StdioFile::~StdioFile | ( | ) | [virtual] |
Class destructor.
Destroys the I/O file object.
bool StdioFile::close | ( | ) |
Close file.
Closes the stream file. If the media was mounted associated with this file, it will be automatically unmounted, provided that no other files are open on that media.
long StdioFile::getSize | ( | ) |
Get file size.
Get the length of the file
bool StdioFile::isEOF | ( | ) |
Get End-of-File flag.
bool StdioFile::open | ( | const char * | fileName, | |
OpenMode | mode | |||
) |
Open file.
Opens a stream file with the given file name. When required, the corresponding media will be also mounted.
fileName | Contains the file name. | |
mode | Specifies the file access mode. |
size_t StdioFile::readData | ( | void * | pData, | |
size_t | maxLen | |||
) |
Read data from file.
Reads the data from file to a specified buffer.
pData | Pointer to the data buffer. | |
maxLen | Specifies the length of the data to be read. |
std::string StdioFile::readString | ( | ) |
Read string from file.
Reads a string from the file.
bool StdioFile::writeData | ( | const void * | pData, | |
size_t | dataLen | |||
) |
Write data to file.
Writes the given data buffer to file at the current position.
pData | Points to the data buffer. | |
dataLen | Specifies the length of the data buffer. |
bool StdioFile::writeString | ( | const char * | strData | ) |
Write string to file.
Writes the specified string to the file at the current position.
strData | Pointer to a null terminated character string. |
FILE* StdioFile::fileStream [protected] |
File handle for currently opened file