HOME | DOWNLOAD | DOCS | DEVELOPMENT | LICENSE | CREDITS |
File stream. More...
#include <iDataStream.h>
Public Member Functions | |
iFileStream () | |
Default constructor. | |
iFileStream (const char *filename, iFileMode mode) | |
Convenience constructor. | |
~iFileStream () | |
Destructor. | |
bool | open (const char *filename, iFileMode mode) |
Opens a file from disk. | |
bool | close () |
Closes the file associated with this stream. | |
long | read (void *data, long size, long count) |
Reads data from the stream. | |
long | write (const void *data, long size, long count) |
Writes data to the stream. | |
int | getc () |
Reads a character from the stream. | |
int | putc (int chr) |
Writes a character to the stream. | |
bool | flush () |
Flushes the stream. | |
long | size () const |
Returns the size of the stream. | |
long | tell () const |
Returns the current value of the stream's position indicator. | |
bool | seek (long offset, iDataSeek origin) |
Sets the position of the stream's position indicator. | |
bool | atEnd () const |
Checks if the end of the stream has been reached. |
File stream.
imagen::iFileStream::iFileStream | ( | ) | [inline] |
Default constructor.
imagen::iFileStream::iFileStream | ( | const char * | filename, |
iFileMode | mode | ||
) |
bool imagen::iFileStream::open | ( | const char * | filename, |
iFileMode | mode | ||
) |
Opens a file from disk.
filename | : The name of the file to open. |
mode | : The mode to open the file with. |
bool imagen::iFileStream::close | ( | ) | [virtual] |
Closes the file associated with this stream.
Even though the stream is closed on destruction, it's still good practice to call this function when you're done with the stream.
Implements imagen::iDataStream.
long imagen::iFileStream::read | ( | void * | data, |
long | size, | ||
long | count | ||
) | [virtual] |
Reads data from the stream.
data | : The array to place the read data into. |
size | : The size in bytes of each element to read. |
count | : The number of elements to read. |
Implements imagen::iDataStream.
long imagen::iFileStream::write | ( | const void * | data, |
long | size, | ||
long | count | ||
) | [virtual] |
Writes data to the stream.
data | : The array of data to write. |
size | : The size in bytes of each element to write. |
count | : The number of elements to write. |
Implements imagen::iDataStream.
int imagen::iFileStream::getc | ( | ) | [virtual] |
Reads a character from the stream.
Implements imagen::iDataStream.
int imagen::iFileStream::putc | ( | int | chr | ) | [virtual] |
Writes a character to the stream.
Implements imagen::iDataStream.
bool imagen::iFileStream::flush | ( | ) | [virtual] |
Flushes the stream.
If the file was open for writing, any unwritten data in the buffer will be written to the file.
Implements imagen::iDataStream.
long imagen::iFileStream::size | ( | ) | const [inline, virtual] |
Returns the size of the stream.
Implements imagen::iDataStream.
long imagen::iFileStream::tell | ( | ) | const [virtual] |
Returns the current value of the stream's position indicator.
Implements imagen::iDataStream.
bool imagen::iFileStream::seek | ( | long | offset, |
iDataSeek | origin | ||
) | [virtual] |
Sets the position of the stream's position indicator.
offset | : The new position relative to origin |
origin | : The reference position to add offset to. |
Implements imagen::iDataStream.
bool imagen::iFileStream::atEnd | ( | ) | const [virtual] |
Checks if the end of the stream has been reached.
Implements imagen::iDataStream.
API Documentation by Mark D. Procarione | Generated by |