API Guides > ConceptRT 3.x
FileStream Class Reference

Abstraction of a file. More...

Detailed Description

Abstraction of a file.

See also
Stream
Examples:
Machine/main.cpp, and SystemMode/main.cpp.
+ Inheritance diagram for FileStream:

Public Member Methods

 FileStream ()
 Default constructor. More...
 
 FileStream (PCChar8 fileName, FileMode mode)
 Default constructor that directly open the file. More...
 
 ~FileStream ()
 Destructor. More...
 
bool Open (PCChar8 fileName, FileMode mode)
 Opens the given file. More...
 
void Close ()
 Closes the file. More...
 
bool IsModeRead () const
 Query if the file is in mode read. More...
 
bool IsOpen () const
 Query if the file is open. More...
 
bool EndOfStream () const
 Query if end of stream. More...
 
Char8 ReadChar ()
 Reads the character. More...
 
void WriteChar (Char8 c)
 Writes a character. More...
 
void Flush ()
 Flushes the file. More...
 
Int32 GetPosition () const
 Gets the current position of the cursor in the file. More...
 
- Public Member Methods inherited from Stream
virtual ~Stream ()
 Destructor. More...
 
Int32 CopyFrom (Stream &stream, Int32 count)
 Copies from. More...
 
Int32 CopyFrom (Stream &stream)
 Copies from described by stream. More...
 

Constructor & Destructor Documentation

Default constructor.

FileStream ( PCChar8  fileName,
FileMode  mode 
)

Default constructor that directly open the file.

Parameters
fileNameFilename of the file.
modeThe mode.
RT Exceptions:
RT_ERROR_FILE_COULD_NOT_OPEN
~FileStream ( )

Destructor.

Methods Documentation

void Close ( )

Closes the file.

Warning
Non-Deterministic. Determinism when using ConceptRT library can be ensure by using Context Time Critical mechanisms.
Examples:
Machine/main.cpp.
bool EndOfStream ( ) const
virtual

Query if end of stream.

Returns
true if it is, false if it isn't.

Implements Stream.

void Flush ( )
virtual

Flushes the file.

Implements Stream.

Int32 GetPosition ( ) const
virtual

Gets the current position of the cursor in the file.

Returns
The position.

Implements Stream.

bool IsModeRead ( ) const

Query if the file is in mode read.

Returns
true if mode read, false if not.
bool IsOpen ( ) const

Query if the file is open.

Returns
true if open, false if not.
bool Open ( PCChar8  fileName,
FileMode  mode 
)

Opens the given file.

Parameters
fileNameFilename of the file.
modeThe mode.
Returns
true if it succeeds, false if it fails.
Char8 ReadChar ( )
virtual

Reads the character.

Returns
The character.

Implements Stream.

void WriteChar ( Char8  c)
virtual

Writes a character.

Parameters
cThe character to write.

Implements Stream.